gpt4 book ai didi

ios - UIModalPresentationFormSheet 关闭 iOS 中首选项的事件

转载 作者:行者123 更新时间:2023-11-28 22:38:43 28 4
gpt4 key购买 nike

我在 iPad 中使用以下代码使用 UIModalPresentationFormSheet 执行首选项功能。

self.preferencesViewController = [[PreferenceViewController alloc] initWithNibName:@"PreferenceViewController" bundle:nil];
self.preferencesViewController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:self.preferencesViewController animated:YES];

当我保存首选项并使用

关闭 View Controller 时
[self dismissModalViewControllerAnimated:YES];

但我的偏好没有改变。

我在 viewWillAppear 中编写了我的检查首选项编码,但是 viewWillAppear 事件不适用于 UIModalPresentationFormSheet

我用的时候很好

self.preferencesViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentViewController:self.preferencesViewController animated:YES completion:nil];

我在哪里可以检查 UIModalPresentationFormSheet 的事件?

感谢您的帮助。

最佳答案

将信息返回给创建您的 Controller 的标准方法是使用委托(delegate)协议(protocol)。您的 preferenceViewController 应该定义一个委托(delegate)协议(protocol),并且呈现 Controller 应该在呈现首选项 Controller 之前将自己设置为委托(delegate)。当您开始保存首选项时,PreferenceViewController 应该向它的委托(delegate)发送一条消息,说明它已完成并应该被取消。在呈现 Controller 中实现该委托(delegate)方法时,它可以从您保存它们的位置读取首选项,并关闭 PreferenceViewController。

关于ios - UIModalPresentationFormSheet 关闭 iOS 中首选项的事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15187095/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com