2015-06-23 83 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'' –

相關問題