自动 FirstView 控制器在 viewdidAppear 中调用第二个视图控制器
我在标签栏中的导航控制器中使用了 2 个视图。在导航中的第一个视图控制器应该自动调用第二个视图控制器而不显示第一个视图控制器(通过在 viewdidAppear 上推送 PushViewController )。
问题是,当我第一次单击选项卡栏时,它会转到第二个视图控制器,而没有正确显示第一个视图。但是当我再次按下标签栏时,它会显示带有过渡样式的第一个视图(popviewcontroller)。
谁能告诉我我做错了什么?
预先感谢
问候, 萨蒂什
I am using 2 views in navigation controller in a tab bar. In that First view controller in navigation should automatically call the second view controller without showing First view controller ( by pushing pushviewcontroller on viewdidAppear).
The issue is when i click on the tab bar on first time it goes to Second view controller without any showing of First view correctly . but when I press the tab bar again it show the First view with transition style(popviewcontroller).
Can anyone suggest me what i have went wrong?
Thanks in advance
Regards,
sathish
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您使用 initWithNibName 创建视图控制器,请使用 viewDidLoad 事件而不是 viewDidAppear。
If you are using initWithNibName to create your view controllers use the viewDidLoad event instead the viewDidAppear.
只需在 -(void)ViewwillAppear:(BOOL)Animated 中使用调用第二个视图控制器,那么它不会给出任何问题
just use call second view controller in -(void)ViewwillAppear:(BOOL)Animated then it not give any problem
你为什么要这么做?
实际上将第二个视图添加为子视图,或者如果您确实必须将其放入 viewWillAppear:(BOOL)animated 中 - 但每次调用它的效率确实很低。但同样,为什么要将一个视图控制器推到另一个视图控制器上?!为什么不将第二个视图控制器设置为根视图控制器呢?
Why would you want to do that?
Add the second view as a subview really, or if you really must put it in
viewWillAppear:(BOOL)animated
- but calling it every time is really inefficient. But again, why would you want to push a view controller over another view controller?! Why don't you just make the second view controller the root view controller?