您的位置:首页 > 其它

横屏下的ImagePickerController

2014-10-20 13:25 302 查看
Try this way....

As per Apple Document, ImagePicker Controller never Rotate in Landscape mode. You have to use in Potrait Mode only.


For disable Landscape mode only for ImagePicker Controller follow below code.

In your ViewController.m


Make the SubClass(NonRotatingUIImagePickerController) of Image Picker Controller


@interface NonRotatingUIImagePickerController : UIImagePickerController

@end

@implementation NonRotatingUIImagePickerController
// Disable Landscape mode.
- (BOOL)shouldAutorotate
{
return NO;
}
@end

Use as follow

UIImagePickerController* picker = [[NonRotatingUIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self;
etc.... Just as Default ImagePicker Controller

This is working for me & Let me know if you have any Problem.

补充,需要再AppDelegate下面添加如下代码:

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {

return UIInterfaceOrientationMaskAll;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: