写真をクリックしてフォトギャラリーから画像を選択する 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;
}