简体   繁体   English

以编程方式切换标签栏并查看加载问题

[英]Switch tabbar programmatically and viewdidload question

I am using the set selected index method in the tabbar to switch views but I noticed that the viewdidload method gets called all the time. 我在标签栏中使用set selected index方法来切换视图,但是我注意到viewdidload方法一直被调用。 Is that something expected? 那是期望吗? This is odd because I would expect the xib to have already been loaded. 这很奇怪,因为我希望xib已被加载。 So basically if i switch to view 1 then call view 2 and then back to view 1 , view 1 would have called viewdidload 2 times which is odd. 因此,基本上,如果我切换到视图1,然后调用视图2,然后再返回到视图1,则视图1将调用viewdidload 2次,这很奇怪。

I would appreciate if someone can clarify that. 如果有人可以澄清我将不胜感激。

Are you retaining the view properly? 您是否正确保留了视图? To me, it seems like that would be the issue. 在我看来,这就是问题所在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM