如何防止 Storyboard Segue 重置 UIPopoverController 内的 UIViewController
这是我的问题。通过 Storyboard 的 segue,我可以为栏按钮设置弹出框 segue。 UIPopoverController 内的 UIViewController 需要从服务器加载数据。使用故事板,每次我关闭弹出窗口时,视图都会被释放,因此每当弹出窗口再次出现时,它都会尝试再次从服务器加载数据。我不想要这种行为。如何防止 Storyboard 重置弹出窗口控制器内的视图控制器?就像 UITabBarController 所做的那样。 UITabBarController 第一次调用 viewDidLoad ,并在后续选项卡切换时调用 viewWillAppear 。
Here's my problem. With Storyboard's segue I am having a popover segue for a bar button. The UIViewController inside the UIPopoverController requires to load the data from a server. With Storyboards, everytime I close the popover the view is released so whenever the popover appears again it tries to load data again from server. I dont want this behavior. How can I prevent Storyboard from resetting the view controller inside popover controller? Something like what UITabBarController does. UITabBarController calls viewDidLoad for the first time and for the subsequent tab switches viewWillAppear is called.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Segue就是这样设计的。每次执行 segue 时,视图都会被加载。
如果您需要存储它的数据 - 您应该将其存储在弹出窗口之外,并使用
在 segue 之前调用的此方法,并在此方法中将数据设置为弹出窗口。
如果您将使用它 - 不要忘记在 Interface Builder 中设置 Segue 标识符。
Segue is designed so. Every time you do segue - view will be loaded.
If you need to store it's data - you should store it outside popover and use this method
which calls before segue, and in this method set data to popover.
If you will use it - don't forget to set Segue identifier in Interface Builder.