UIImagePickerController
应该在风景中打开吗?我尝试使用类别,但它无法正常工作。如何修改UIImagePickerController
的方向?
答案 0 :(得分:0)
您应该使用UIPopoverController以横向模式显示ImagePickerController
-(void)showImagePicker:(id)sender
{
UIButton *button = (UIButton *)sender; // button is on which user will tap to show image picker
UIImagePickerController *imgPicker = [[UIImagePickerController alloc] init];
imgPicker.delegate = self;
imgPicker.allowsEditing = YES;
imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
self.popover = [[UIPopoverController alloc] initWithContentViewController:imgPicker];
[self.popover presentPopoverFromRect:button.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
答案 1 :(得分:0)
UIImagePickerController类仅支持纵向模式。此类旨在按原样使用,不支持子类化。
答案 2 :(得分:0)
这很容易。尝试创建一个UIImagePickerController的自定义类。覆盖其中的supportedInterfaceOrientations方法:
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL)shouldAutorotate{
return YES;
}