我试图让 popover
在我单击按钮时自行消失,但它似乎不起作用。我知道有几个问题,但我认为我的设置略有不同。在 Storyboard 中,我有以下设置:
View Controller -> (segue popover) -> View Controller 2
View Controller 2 有一个链接到 IBAction 的“完成”按钮,如下所示:
- (IBAction)returnCommand:(id)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}
我知道您可以在弹出窗口外单击以关闭它,但我想在按下完成 时做一些其他事情。使用此代码,当我单击“完成”按钮时没有任何反应。
最佳答案
使用 UIPopover 方法 dismissPopoverAnimated:
关闭弹出框。来自文档:
Discussion
You can use this method to dismiss the popover programmatically in response to taps inside the popover window. Taps outside of the popover’s contents automatically dismiss the popover.
关于ios - Popover 并没有解雇自己,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20768267/