UIPopOverController + UITableView - 选择单元格时隐藏弹出窗口
在我的 Popover 控制器中,我有一个表格视图。选择单元格时,我想隐藏弹出窗口。 我怎样才能实现它。
In my Popover controller, i'm having a table view. On selection of a cell, I want to hide the pop over.
How can I achieve it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在根视图控制器的头文件中:
在实现文件中:
当您想要隐藏弹出窗口时:
在表视图中,添加委托并在根视图控制器中实现委托。当调用委托方法时,使用上面的代码来关闭弹出窗口。
In Header file of Root view controller:
In the implementation file:
When ever you want to hide the pop over:
In the table view, add a delegate and implement the delegate in root view controller. When the delegate method is called, use above code to dismiss the pop over.
请允许我建议一个稍微不同的解决方案,其中包括传递弹出窗口控制器引用而不是 segue 引用。
在源视图控制器的实现文件中:
在目标视图控制器的头文件中:
在目标视图控制器的实现文件中:
相同的文件,每当您想要关闭弹出窗口时:
Allow me to suggest a slightly different solution, which consists in passing the popover controller reference instead of the segue reference.
In the implementation file of the source view controller:
In the header file of the destination view controller:
In the implementation file of the destination view controller:
Same file, whenever you want to dismiss the popover:
苹果文档建议如下:
http://developer.apple.com/库/ios/#documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/Popovers.html
The apple docs recommend the following:
http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/Popovers.html
在 didSelectRowAtIndexPath 尝试这个代码
in didSelectRowAtIndexPath try this code