如何在TabBarApplication中的UiView中添加UIImagePickerController
无论你是否在选项卡中,此代码都应放入视图控制器类中
需要时创建选择器
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;
(第一个应该从info对象中获取图像)
在每个消息完成后,删除选择器。
[self dismissModalViewControllerAnimated:YES];