我试图从视图中删除图像选择器,但没有成功。
发生的情况是,一开始我会看到所有用户相册,然后选择一个并编辑图像,然后再调用代理,然后关闭控制器,但是我再次看到相册视图,而我无法删除它来自控制器。
这是我添加的方式:
pickerLibrary = [[UIImagePickerController alloc] init];
pickerLibrary.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
pickerLibrary.delegate = self;
pickerLibrary.allowsEditing=YES;
pickerLibrary.mediaTypes= [[NSArray alloc] initWithObjects: (NSString *) kUTTypeImage, nil];
[self presentViewController:pickerLibrary animated:YES completion:nil];
在代表下,我做到了:
[self dismissViewControllerAnimated:YES completion:^
{
//till here works fine, but than go back to albums page, here i have tried :
[self dismissViewControllerAnimated:YES completion:nil];
[pickerLibrary.view removeFromSuperView];
//or even setting a timer and than try to close it .
}];
好的,似乎- (void)viewDidLoad
在我关闭图像选择器之后再次调用了该方法,而不是他再次加载了视图控制器。
解决方案是为此设置一个布尔值。
首先出现在视图中的原因是因为如果视图中的视图确实已加载,则会收到警告。(请参阅链接)
可以在这里看到对此答案的参考:
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句