我有一个弹出窗口,它在导航栏按钮上弹出,并且弹出窗口包含一个表格 View 。
如何在tableview的didSelectRowAtIndexPath
方法上消除ios中的popover?
最佳答案
如果您的意思是 tableView 位于该弹出窗口内,并且您的弹出窗口 Controller 实例化如下:
Objective-C
在包含 Controller 中,将其放在其顶部:
@property (nonatomic,strong) UIPopoverController *popOver;
//this is the content of the popover
MyTableVC *tableVC = [self.storyboard instantiateViewControllerWithIdentifier:@"myTableView"];
//this is the navigation controller of your tableViewController
UINavigationController *popNav = [[UINavigationController alloc] initWithRootViewController:tableVC];
//this is you popover
self.popOver =[[UIPopoverController alloc] initWithContentViewController:popNav];
然后你必须在该 viewController 中关闭它,你已经从中创建了弹出框,在本例中它是 popNav。
因此,在 MyTableVC 类中,您需要在 didSelectRowAtIndexPath 方法中调用此方法:
[self dismissViewControllerAnimated:YES completion:nil];
关于ios - 关闭 ios 中 didSelectRowAtIndexPath 上的弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39305330/