我正在尝试使用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启动了这个项目(如果重要的话,不知道)。
答案 0 :(得分:0)
您需要确保在分配之前实例化“窗口”并显示弹出窗口。