我正面临一个关于横向定位的问题,以查看由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 :(得分:0)
你必须改变interfaceOrienation mask。尝试在appDelegate中添加它
-(UIInterfaceOrientationMask)application:(UIApplication *)application
supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
return UIInterfaceOrientationMaskAll;
else //iPad
return UIInterfaceOrientationMaskAllButUpsideDown;
}