gpt4 book ai didi

ios - dismissModalViewControllerAnimated : does not dismiss the modal view

转载 作者:行者123 更新时间:2023-11-28 23:10:46 34 4
gpt4 key购买 nike

捕获图像后,回调发生,但出现错误,因为它没有关闭相机 View 。我的代码非常简单,我唯一的疑问是我使用的是选项卡栏 Controller 并将 imagePicker 推送到其中一个选项卡中,这只是一个想法。

- (IBAction)imageButtonPressed:(id)sender {
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;
imagePicker.allowsEditing = YES;
[self presentModalViewController:imagePicker animated:YES];
}



- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[self dismissModalViewControllerAnimated:YES];
self.portaitImage.image = [info objectForKey:UIImagePickerControllerOriginalImage];
}

最佳答案

你需要关闭 UIImagePickerController,而不是 self:

[picker dismissModalViewControllerAnimated:YES];

关于ios - dismissModalViewControllerAnimated : does not dismiss the modal view,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8310108/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com