2012-07-18 159 views
2

大家好我是新iPhone开发者的popoverview和开放imagepicker,UIpopoverviewcontroller点击按钮隐藏父视图

我而开的UIImagePickerController问题。

我有选项拍摄照片并在popoverview中打开画廊拍照并打开相机时间隐藏popoverview并打开画廊隐藏popover并从父视图控制器打开imagepicker imagepicker不应从popover视图控制器打开。

请分享你的想法。

回答

2

//为了打开相机

-(void)btnCameraClicked { 
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) { 
     imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera; 
     [self presentModalViewController:imgPicker animated:YES]; 
    } 
    else { 
     UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"Camera is not Available" delegate:self cancelButtonTitle:nil otherButtonTitles:@"Ok",nil]; 
     [alert show]; 
     [alert release]; 
    } 
} 

//为了打开图像拾取控制器

-(void)btnGalleryClicked { 
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) { 
     imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
     [self presentModalViewController:imgPicker animated:YES]; 
    } 
    else { 
     UIAlertView *alert = [[UIAlertView alloc]initWithTitle:nil message:@"Photos are not available" delegate:self cancelButtonTitle:nil otherButtonTitles:@"Ok",nil]; 
     [alert show]; 
     [alert release]; 
    } 
} 

这一点,你可以使用ImagePicking方法后想:

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker 

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

您可以使用UIPopoverControllerDelegate方法

-(void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController;