我正在尝试使用FPPopover打开通知视图,它可以在应用程序上的iOS 5上运行,但不会在iOS 6上显示。但是,如果我对不同的项目使用相同的代码来执行此操作,它确实会在iOS 5和6上显示
这就是我在这两个项目中所做的。
- (IBAction)NotificationButtonPressed:(id)sender {
[self openNotificationsPopOver:sender];
}
- (void)openNotificationsPopOver:(id)sender {
[self setNotificationCount:0];
NotificationViewController *vc = [[UIStoryboard storyboardWithName:@"Notification" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"NotificationViewController"];
// NotificationViewController *vc = [[NotificationViewController alloc]init];
// [vc setParentViewController:self];
FPPopoverController *popover = [[FPPopoverController alloc] initWithViewController:vc];
//sender is the UIButton view
[popover presentPopoverFromView:sender];
//popover.arrowDirection = FPPopoverArrowDirectionAny;
popover.tint = FPPopoverDefaultTint;
popover.contentSize = CGSizeMake(200, 250);
popover.arrowDirection = FPPopoverArrowDirectionAny;
NSLog(@"Present popover");
//sender is the UIButton view
[popover presentPopoverFromView:sender];
// [popover presentPopoverFromPoint:CGPointMake(160, 0)];
//sender is the UIButton view
// [popover presentPopoverFromView:self.navigationController.navigationBar];
}我也尝试使用为它注释掉的代码行……所有方法都适用于单独的项目(iOS 5和6),但仅适用于主项目( iOS 5
我还尝试了删除框架并重新添加它们。从xCode 4.3开始这个项目(不知道这是否重要)。
发布于 2013-03-24 09:36:53
你需要确保“窗口”在alloc和呈现弹出窗口之前被实例化。
https://stackoverflow.com/questions/13580646
复制相似问题