UIImagePickerController和风景取向
问题描述:
我有一个UIImagePicker来点击一张图片,并从照片库中选择一个图像。但我的应用程序只支持横向导向。照片库只能通过ImagePicker以纵向模式打开。我尝试将当前的代码与ALAssets集成,但我不知道AlAssets库。我想使用图像选取器并使其在startMediaBrowserFromViewController:方法中调用ALAssets。以下是方法定义。请给我一个解决方案。UIImagePickerController和风景取向
//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;
}
答
UIImagePickerController
仅支持UIInterfaceOrientationPortrait
方向,所以我用ELCImagePickerController
挑选图片也没关系,如果它是从横向视图 - 控制呈现,它会显示INT纵向,甚至没有在UIInterfaceOrientationPortraitUpsideDown
答
。对于我来说,在具有比“正常” UIImagePickerController
许多优点:
- 你可以选择多个图片
- 轻松支持横向模式
- 容易定制
- ...
我认为在默认情况下,它不支持横向导向,但我的工作非常简单。如果您需要帮助,请发表评论。
检查Gituhub
您能找到解决方案吗?我有同样的情况,并试图找到方式。我在他的iPhone版本中看到了这个应用程序“Story Creator”,并且做了这个诀窍,但是我还找不到它。 – Beto 2013-10-11 17:45:07