iphone - 图像选择器弹出框

标签 iphone ios xcode

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 Controller 而不是图像选择器。请帮助。我在弹出窗口中显示它,因为我认为,这就是为什么它变慢的原因,因为图像选择器应该与 iPad 的弹出窗口一起出现。

最佳答案

您是否正在实现 AGImagePickerController 委托(delegate)?

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

在那里你可以关闭你的UIPopoverController

关于iphone - 图像选择器弹出框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11444465/

相关文章:

iphone - 如何判断应用程序是由于 Titanium 中的推送通知而打开还是恢复?

iphone - 在 iPhone 应用程序中存储信用卡详细信息

ios - 如何在屏幕上显示模拟器键盘时使用 Mac 键盘

ios - 开源项目在 Xcode 中有 `No Scheme`

iphone - 处理工厂方法中的内存泄漏

iphone - 如何为armv6、armv7和i386编译静态库(fat)

ios - 基于核心数据对象,仅选择带有复选标记的一行

ios - 更改 UITableViewCell 中圆形编辑按钮的颜色

ios - 在启用 ARC 的应用程序中未调用 Dealloc

objective-c - 在 OSX 上的联系人(例如应用程序)上存储应用程序数据的最佳方式是什么