2012-07-18 189 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;