TabBarApplication の UiView に UIImagePickerController を追加する方法
4378 次
1 に答える
15
タブ内にいるかどうかは関係ありません。このコードは、ビューのViewControllerクラスに入ります。
必要なときにピッカーを作成する
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
// configure it how you want
ピッカーを追加します
[self presentViewController:picker animated:YES completion:nil];
ビューコントローラは次のように宣言する必要があります
@interface YourViewController :
UIViewController<UIImagePickerControllerDelegate, UINavigationControllerDelegate>
そして、あなたは実装する必要があります
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info;
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker;
(最初のものは情報オブジェクトから画像を取得する必要があります)
これらの各メッセージで、完了したらピッカーを削除します
[self dismissModalViewControllerAnimated:YES];
于 2011-02-05T20:21:28.313 に答える