gpt4 book ai didi

iphone - 如何替换模态视图 Controller ?

转载 作者:行者123 更新时间:2023-12-03 19:23:17 27 4
gpt4 key购买 nike

我正在使用模态视图 Controller 来允许用户选择地址簿条目和电子邮件地址。 ABPeoplePickerNavigationController 对象通过 presentModalViewController:animated 显示:

[self presentModalViewController:picker animated:YES];

我想要做的是保持模式对话框打开,但是当用户选择电子邮件地址时,它应该交叉淡入淡出到显示消息撰写窗口的不同 Controller 。

我在 peoplePickerNavigationController:shouldContinueAfterSelectingPerson:property:identifier: 中尝试了各种方法来关闭选择器并将我的自定义组合 Controller 设置为模态视图。我可以通过多种方式做到这一点,但它永远不会从选择器平滑地淡出到合成 Controller ——除非我将合成 Controller 设置为选择器的模式对话框,在这种情况下,当我关闭合成时,选择器会重新出现 Controller 。我也不想要这样。

必须有某种方法可以顺利地将一个 Controller 及其 View 替换为另一个 Controller 及其 View ,所有这些都在模式对话框的上下文中,并且最好使用交叉淡入淡出。非常感谢您的建议。

最佳答案

将合成 Controller 添加为选择器的 subview 。将其 alpha 设置为 0,使其透明。然后使用动画 block 逐渐将其 Alpha 动画化至完整:

// Initially set alpha to 0    
[myCompositionView setAlpha:0];

// Later when you want to show the view, animate the alpha to 1.0
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[myCompositionView setAlpha:1.0];
[UIView commitAnimations];

关于iphone - 如何替换模态视图 Controller ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2536051/

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