2015-09-29 22 views
0

我正面臨一個問題,關於橫向方向查看控制器推uiimagepickercontroller。我從控制器中選擇了下面的代碼。允許橫向也可以查看控制器按uiimagepickercontroller

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info 
{ 
     UIImage *editImage=[info objectForKey:UIImagePickerControllerEditedImage]; 
     NSData *data=[[ConstantIM shareInstance] compressImage:editImage]; 

     self.imgCirclephoto.image = [ConstantIM imageWithImage:[UIImage imageWithData:data] scaledToWidth:[UIScreen mainScreen].bounds.size.width scaledToHeight:[UIScreen mainScreen].bounds.size.height]; 

     [[ConstantIM shareInstance] restrictRotation:NO]; 

     ImageChooseCancelView *cropController = [[ImageChooseCancelView alloc] initWithNibName:@"ImageChooseCancelView" bundle:nil]; 
     cropController.imgSel = editImage; 
     cropController.imgDelegate = self; 

     [picker pushViewController:cropController animated:YES]; 
} 

在ImageChooseCancelView我寫了下面的代碼,讓風景模式:

- (NSUInteger)supportedInterfaceOrientations{ 
    return UIInterfaceOrientationMaskLandscape; 
} 

任何幫助將不勝感激。提前致謝。

回答

0

你必須cahnge的interfaceOrienation掩蓋。嘗試添加該在的appDelegate

-(UIInterfaceOrientationMask)application:(UIApplication *)application 
supportedInterfaceOrientationsForWindow:(UIWindow *)window 
{ 
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) 
    return UIInterfaceOrientationMaskAll; 
else //iPad 
    return UIInterfaceOrientationMaskAllButUpsideDown; 
} 
+0

我已經在的appDelegate –

+0

定義這個方法@ShahPaneri您的應用程序仍然會崩潰? – Misha

+0

不,我的應用程序沒有崩潰,但是它是通過imagepickercontroller在橫向模式下打開推送的視圖控制器。我的圖像採集器控制器也不能在橫向模式下打開。 –

相關問題