我有一个UIImagePicker来点击图片并从照片库中选择一张图片。但我的应用程序必须只支持横向。照片库仅通过ImagePicker以纵向模式打开。我尝试将当前代码与ALAssets集成,但我不知道AlAssets库。我想使用图像Picker并使其在startMediaBrowserFromViewController:方法中调用ALAssets。以下是方法定义。请给我一个解决方案。
//pick an image from photo gallery
- (BOOL) startMediaBrowserFromViewController: (UIViewController*) controller
usingDelegate: (id <UIImagePickerControllerDelegate,
UINavigationControllerDelegate>) delegate {
if (([UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypeSavedPhotosAlbum] == NO)
|| (delegate == nil)
|| (controller == nil))
return NO;
UIImagePickerController *mediaUI = [[UIImagePickerController alloc] init];
mediaUI.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
//provides access to photo albums in the device.
mediaUI.mediaTypes=[[[NSArray alloc]initWithObjects:(NSString*)kUTTypeImage,nil]autorelease];
// Hides the controls for moving & scaling pictures.
mediaUI.allowsEditing = NO;
mediaUI.delegate = delegate;
[controller presentModalViewController: mediaUI animated: YES];
return YES;
}
答案 0 :(得分:0)
UIImagePickerController
仅支持UIInterfaceOrientationPortrait
方向,因此如果它是从横向视图控制器呈现的那么无关紧要,它将以纵向方式显示,即使在UIInterfaceOrientationPortraitUpsideDown
答案 1 :(得分:0)
我使用ELCImagePickerController
来挑选图片。对我而言,与“普通”UIImagePickerController
相比,它具有许多优势:
我认为默认情况下它不支持横向定位,但我的工作非常简单。如果您需要帮助,请发表评论。
上查看