ユーザーが画像をアップロードできるアプリに取り組んでいます。ライブラリから画像を選択するとき、最初にカメラ ロール (保存された写真)をロードするだけでなく、残りのフォト ライブラリ(つまり、他のアルバム)にアクセスするための「戻る」ボタンも提供します。
これが私のコードです:
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.delegate = self;
imagePicker.allowsEditing = NO;
[self presentModalViewController:imagePicker animated:YES];
}
else {
UIAlertView *alert;
alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"This device doesn't support photo libraries."
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
}
これは、ユーザーが任意のアルバムから任意の画像を選択できるフル フォト ライブラリ画面から始まりますが、カメラ ロールに入るにはもう 1 回タップしてから、次のアップロード画面に進む必要があります。
切り替えるimagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
と、カメラロールから始まりますが、他のアルバムへのアクセスは許可されません。
何か案は?ありがとう!