AGImagePickerController *imagePickerController = [[AGImagePickerController alloc] initWithFailureBlock:^(NSError *error) {
if (error == nil)
{
NSLog(@"User has cancelled.");
[self dismissModalViewControllerAnimated:YES];
} else
{
NSLog(@"Error: %@", error);
// Wait for the view controller to show first and hide it after that
double delayInSeconds = 0.5;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[self dismissModalViewControllerAnimated:YES];
});
}
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:YES];
} andSuccessBlock:^(NSArray *info) {
NSLog(@"Info: %@", info);
[self dismissModalViewControllerAnimated:YES];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:YES];
}];
popover = [[UIPopoverController alloc] initWithContentViewController:imagePickerController];
[popover presentPopoverFromRect:CGRectMake(0.0, 0.0, 400.0, 400.0)
inView:self.view.window
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
能够呈现它,但是,即使我更改它的大小仍然相同,当我按下DONE
按钮时,它会删除我的View控制器而不是imagepicker。请帮忙。我把它呈现在popover中,因为我认为,这就是为什么它的速度慢,因为imagepicker应该与iPad的popover一起出现。
答案 0 :(得分:1)
您是否正在实施AGImagePickerController委托?
- (void)agImagePickerController:(AGImagePickerController *)picker didFinishPickingMediaWithInfo:(NSArray *)info;
在那里你可以解雇你的UIPopoverController
。
答案 1 :(得分:0)
调整大小以这种方式设置:
[popoverController setPopoverContentSize:CGSizeMake(1024, 500)];
然后在您使用的andSuccessBlock
和其他部分:
[self dismissModalViewControllerAnimated:YES];
应该是
[popoverController dismissPopoverAnimated:YES];
这就是为什么ViewController
被解雇或从视图中移除的原因,因为它被错误地解雇了。