首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何将UIImagePickerController控制器添加到基于ipad的应用程序中以显示多个图像?

如何将UIImagePickerController控制器添加到基于ipad的应用程序中以显示多个图像?
EN

Stack Overflow用户
提问于 2011-06-09 19:13:06
回答 2查看 1.5K关注 0票数 0

我在基于ipad的application.so中使用uiimage选择器控件,我使用以下代码显示它:

代码语言:javascript
运行
复制
[self presentModalViewController:myImagePicker animated:YES];

但是有一个错误显示

代码语言:javascript
运行
复制
'On iPad, UIImagePickerController must be presented via UIPopoverController'

如何添加一个UIImagePickerController控制器到我的基于ipad的应用程序来显示多个images.can谁给我一个很好的方法。

EN

回答 2

Stack Overflow用户

发布于 2011-06-09 19:26:14

就像你在this.When操作按钮中点击一个按钮一样,调用this。

代码语言:javascript
运行
复制
UIActionSheet *photoActionSheet = [[UIActionSheet alloc] initWithTitle:@"" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Take Photo", @"Choose Existing",nil];

        [photoActionSheet showFromRect:CGRectMake(315, 355, 10, 10) inView:self.view animated:YES];
票数 0
EN

Stack Overflow用户

发布于 2011-06-09 20:27:12

代码语言:javascript
运行
复制
#pragma mark UIActionSheetDelegate methods

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
    imgPicker.delegate = self;


    if(buttonIndex == 0){

            if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]){
                imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
                [self presentModalViewController:imgPicker animated:YES];

        }


    else if(buttonIndex == 1){


            imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
            [self presentModalViewController:imgPicker animated:YES];


    }

}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6291885

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档