3

我有一个 UIImagePicker 来单击图片并从照片库中选择图像。但我的应用程序必须只支持横向。照片库仅通过 ImagePicker 以纵向模式打开。我尝试将当前代码与 ALAssets 集成,但我不知道 AlAssets 库。我想使用图像选择器并使其在 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;
}
4

2 回答 2

0

ELCImagePickerController用来挑选图像。对我来说,与“正常”相比,它有很多优势UIImagePickerController

  • 你可以选择多个图像
  • 轻松支持横向模式
  • 易于定制
  • ...

我认为默认情况下它不支持横向,但我很容易做到这一点。如果您需要帮助,请发表评论。

Gituhub上查看

于 2013-03-05T07:34:40.767 回答
0

UIImagePickerController仅支持UIInterfaceOrientationPortrait方向,因此无论是从横向视图控制器呈现,它都将显示为纵向方向,即使在UIInterfaceOrientationPortraitUpsideDown

于 2013-03-05T07:01:22.093 回答