1
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按钮时,它会删除我的视图控制器而不是图像选择器。请帮忙。我在弹出窗口中呈现它,因为我认为,这就是为什么它会变慢,因为 imagepicker 应该与 iPad 的弹出窗口一起出现。

4

2 回答 2

1

您是否正在实施 AGImagePickerController 委托?

- (void)agImagePickerController:(AGImagePickerController *)picker didFinishPickingMediaWithInfo:(NSArray *)info;

在那里你可以关闭你的UIPopoverController.

于 2012-07-12T03:27:20.177 回答
0

调整大小这样设置:

[popoverController setPopoverContentSize:CGSizeMake(1024, 500)];

然后在你andSuccessBlock和你使用的其他部分:

[self dismissModalViewControllerAnimated:YES];

应该

[popoverController dismissPopoverAnimated:YES];

这就是为什么ViewController从视图中被解雇或删除的原因,因为它以错误的方式被解雇。

于 2012-07-12T08:24:21.023 回答