首页 > 代码库 > 横屏下的ImagePickerController
横屏下的ImagePickerController
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;
}
横屏下的ImagePickerController
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。