2

こんにちは、私は新しい iPhone 開発者です。

uiimagepickercontroller を開いているときに問題が発生しました。

写真を撮って popoverview でギャラリーを開く オプションがあります 写真を撮ってカメラを開く その時 popoverview を非表示にしてギャラリーを開く ポップオーバーを非表示にして親ビューコントローラーからイメージピッカーを開く イメージピッカーはポップオーバービューコントローラーから開くべきではありません。

あなたのアイデアを共有してください。

4

2 に答える 2

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
于 2012-07-18T06:15:07.817 に答える
2

UIPopoverControllerDelegate メソッドを使用できます

-(void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController;
于 2012-07-18T06:48:01.467 に答える