2015-09-29 20 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在横向模式下打开推送的视图控制器。我的图像采集器控制器也不能在横向模式下打开。 –

相关问题