如何在UiView中添加UIImagePickerController [英] How to add UIImagePickerController in UiView

查看:54
本文介绍了如何在UiView中添加UIImagePickerController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在TabBarApplication的UiView中添加UIImagePickerController

How to add UIImagePickerController in UiView in TabBarApplication

推荐答案

是否在选项卡中都没关系,此代码将进入视图的ViewController类中

It doesn't matter if you are in a tab, this code goes into the ViewController class for your view

在需要时创建一个选择器

Create a picker when you want one

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
// configure it how you want

添加选择器

[self presentViewController:picker animated:YES completion:nil];

您的视图控制器需要像这样声明

Your view controller needs to be declared like

@interface YourViewController :  
   UIViewController<UIImagePickerControllerDelegate, UINavigationControllerDelegate>

您需要实施

- (void)imagePickerController:(UIImagePickerController *)picker 
    didFinishPickingMediaWithInfo:(NSDictionary *)info;
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker;

(第一个应该从info对象获取图像)

(the first one should get the image from the info object)

在每封邮件中,完成后,删除选择器

In each of those messages, when done, remove the picker

[self dismissModalViewControllerAnimated:YES];

这篇关于如何在UiView中添加UIImagePickerController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆