iOS 5.1.1 Popover 不会自动关闭

标签 ios ipad viewcontroller popover

我的应用程序在旧操作系统上运行良好,但在 5.1.1(在 iPad2 和新 iPad 上测试)弹出窗口显示,运行良好但在用户点击弹出窗口外时不会关闭。我不使用任何解雇代码或按钮。我使用 iOS 5.0 SDK,XCode 4.2 来编译应用程序。以下是我的展示方式。有什么想法可能是错误的吗?

- (void)showNotifications {

    NotificationsViewController *vc = [[[NotificationsViewController alloc] init] autorelease];
    vc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;

    if ([UIApplication isIPad]) {

        vc.modalInPopover = YES;
        self.popoverController = [[[UIPopoverController alloc] initWithContentViewController:vc] autorelease];

        [self.popoverController presentPopoverFromRect:bottomView.frame inView:[bottomView superview] permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];

    }
    else
        [self presentModalViewController:vc animated:YES];

}

最佳答案

谜底揭晓。刚刚注释掉了这一行

//vc.modalInPopover = YES; must be no on iOS 5

ModalInPopover 在 iOS 5 上必须为 false。不知道它是否仍然适用于 iOS 4。

关于iOS 5.1.1 Popover 不会自动关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10849578/

相关文章:

ios - [_UIWebViewScrollViewDelegateForwarder scrollViewWasRemoved :]: unrecognized selector sent to instance

ios - 使用模型无法在 cellForRowAtIndexPath 中获取数据

ios - UICollectionViewLayout for Google Chrome (iOS App) Tab Switcher-like UI

ios - 如何使用 RxSwift 交替注册显示 2 个自定义单元格

ios - 我无法在另一个 ViewController 中执行函数

ios - 从另一个 viewController 访问文本字段文本

iphone - iOS - 更新 applicationDidBecomeActive 中的 View Controller

ios - 无法实现 Swift SSLCreateContext

iphone - 通过按钮重置应用程序

iphone - UISearchBar inputAccessoryView 的问题