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 に答える