2015-06-23 51 views
2

我正在开发支持横向的iPad应用程序UIImagePickerController照片快门不打开

我想要做的是,我想打开按钮单击照片库。 这里是我的代码片段,

UIImagePickerController * picker = [[UIImagePickerController alloc] init]; 
picker.delegate = self; 
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
picker.modalPresentationStyle = UIModalPresentationCurrentContext; 

当我写这篇它不会打开照片库:( 我不知道我在做adavance错误

请帮助和感谢。

+0

添加presentViewcontroller方法 –

回答

0

试试这个:

UIImagePickerController *picker=[[UIImagePickerController alloc]init]; 
picker.delegate=self; 
picker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary; 

if([[[UIDevice currentDevice] systemVersion] floatValue]>=8.0) 
{ 
    [[NSOperationQueue mainQueue] addOperationWithBlock:^{ 
     [self presentViewController:picker animated:NO completion:nil]; 
    }]; 
}else{ 
    [self presentViewController:picker animated:YES completion:nil]; 
} 
+0

它crashe s并且显示:'UIApplicationInvalidInterfaceOrientation',原因:'支持的方向与应用程序没有共同的方向,并且shouldAutorotate返回YES'' –

相关问题