我的应用程序在旧操作系统上运行良好,但在 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/