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];
}
}
精彩评论