开发者

How can i add a UIImagePickerController controller to my ipad based application to show multiple images?

开发者 https://www.devze.com 2023-03-11 21:31 出处:网络
iam using uiimage picker control in ipad based application.so i am displaying itusing the following code:

i am using uiimage picker control in ipad based application.so i am displaying it using the following code:

[self presen开发者_开发知识库tModalViewController:myImagePicker animated:YES];

but there is a error that shows

'On iPad, UIImagePickerController must be presented via UIPopoverController'

how can i add a UIImagePickerController controller to my ipad based application to show multiple images.can any one provide me a good way to do it.


Do like this.When you click on a button in button action call this.

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];


#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

精彩评论

暂无评论...
验证码 换一张
取 消