我创建了一个弹出窗口来查看我的设置,如下所示,
if ([popoverController isPopoverVisible]) {
[popoverController
dismissPopoverAnimated:YES];
} else {
UIView* popoverView = [[UIView alloc]
initWithFrame:CGRectMake(566, 440, 0, 0)];
popoverView.backgroundColor = [UIColor blackColor];
controller1.contentSizeForViewInPopover = CGSizeMake(300, 115);
popoverController = [[UIPopoverController alloc]
initWithContentViewController:controller1];
[popoverController presentPopoverFromRect:popoverView.frame
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionUp
animated:YES];
}
我的推送操作代码:
UIStoryboard *storyboard = [UIStoryboard
storyboardWithName:@"MainStoryboard"
bundle:nil];
UIViewController *controller = (UIViewController *)[storyboard
instantiateViewControllerWithIdentifier:@"PCBViewController"];
[self.navigationController
pushViewController:controller
animated:YES];
在我的设置弹出窗口中有一些按钮。单击这些按钮, View Controller 通过推送操作打开,但它不起作用。
我的问题是:如何设置弹出内容的推送操作。
最佳答案
您的 View 是从弹出窗口呈现的,因此 self.navigationController 将为零。
试试这个
UIStoryboard *storyboard = [UIStoryboard
storyboardWithName:@"MainStoryboard"
bundle:nil];
UIViewController *controller = (UIViewController *)[storyboard
instantiateViewControllerWithIdentifier:@"PCBViewController"];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:controller];
[navigationController
pushViewController:controller
animated:YES];
关于ios - UIPopOverController 的推送操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20063132/