手动切换选项卡时未调用 didSelectViewController
我有一个带有三个选项卡的选项卡栏界面。我希望当我在它们之间切换时它们能够动画化。我实现了 didSelectViewController (以及所有相关的委托内容),当我按下选项卡时会调用它,但当我以编程方式切换选项卡时不会调用它。文档说,
“在 iOS v3.0 及更高版本中,无论选定的视图控制器是否更改,选项卡栏控制器都会调用此方法。此外,它仅在响应用户在选项卡栏中点击时调用,而不是在响应用户点击时调用。”当您的代码以编程方式更改选项卡栏内容时调用。”
有人知道任何解决方法吗?
谢谢! - 乔恩
I have a tab bar interface with three tabs. I would like them to animate when I switch between them. I implemented didSelectViewController (and all the associated delegate stuff) which is called when I press the tabs but not when I switch tabs programmatically. The docs say as much,
"In iOS v3.0 and later, the tab bar controller calls this method regardless of whether the selected view controller changed. In addition, it is called only in response to user taps in the tab bar and is not called when your code changes the tab bar contents programmatically."
Anyone know any workarounds?
Thanks! - Jon
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,如果您以编程方式切换它们,为什么不能自己创建适当的动画呢?我的意思是您确实知道选择了哪个选项卡,对吗?
Well, if you are switching them programmatically why can't you create proper animation yourself? I mean you do know which tab gets selected, right?
当您自己以编程方式切换它们时,可以调用该方法。或者编写另一种方法来执行动画并在以编程方式切换选项卡时调用它
you can call the method when you switch them programmatically yourself. or write another method to do your animation and call IT whenever you switch tabs programatically