2

Ipad で使用している UIImagePickerController がありますが、画像の 1 つを選択しても何も起こりません。ピッカーのコードは次のとおりです。

- (IBAction)addPicture:(id)sender {
    CGRect rect = CGRectMake(0, 0, 753, 118);
    [popOverController presentPopoverFromRect:rect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    [self dismissViewControllerAnimated:YES completion:nil];
    patientPicture = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
    UIImageView *pictureView = (UIImageView *)[imageCell viewWithTag:777];
    pictureView.image = patientPicture;
    [_imgViewAdd reloadInputViews];
}
-(void)viewDidLoad {
    pickerController = [[UIImagePickerController alloc] init];
    popOverController = [[UIPopoverController alloc] initWithContentViewController:pickerController];
    popOverController.delegate = self;
}

何が起こるかというと、画像ピッカーが正常にロードされますが、写真の1つを選択しようとしても何も起こりません

前もって感謝します

4

2 に答える 2

1

電話:

[self dismissViewControllerAnimated:YES completion:nil];

最初ではなく最後。

また...

@interface yourViewController ()<UIImagePickerControllerDelegate,UINavigationControllerDelegate>

pickerController デリゲートを設定していません...

pickerController.delegate = self;

ポップオーバーがあるので、これを使用します..

[popOverController dismissPopoverAnimated:YES];
于 2013-08-20T21:07:05.370 に答える
0

これを試すことができます(私にとってはうまくいきました):

    -(void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    NSLog(@"didFinishPickingMediaWithInfo CALLED");

    [picker dismissViewControllerAnimated:YES completion:^{

        testImageView.image    = (UIImage*) [info objectForKey:UIImagePickerControllerEditedImage]; //testImageView is a UIImageView 

    }];
于 2014-03-11T10:17:33.313 に答える