开发者

iPhone UIViews sleeping/dying after being brought back into view

开发者 https://www.devze.com 2022-12-08 04:23 出处:网络
I need some help. This seems to be a common problem I am having when am adding and changing views in my coding. And I would love to learn what I am doing wrong.

I need some help. This seems to be a common problem I am having when am adding and changing views in my coding. And I would love to learn what I am doing wrong.

Currently I am adding and removing views using the following calls from my view controller:

[startView removeFromSuperview];
[self addSubview:secondView];

and then doing the opposite again to go back.

[secondView removeFromSuperview];
[self addSubview:startView];

I am fine up to this point. But the problem I have is that when I then decide to go back to 'startView" and call the first code that I have above for the second time. My View loads but very little works. None of my methods are called, there is no animation and the view is shown but it is "dead" or "asleep". And I have no idea why!

I am basically adding a view, removing it, then adding it again and everything breaks. Can anyone give me a h开发者_StackOverflow社区and as to what might be happening? is it that ViewDidLoad doesn't fire the second time it's loaded? or something like that? I would much appreciate it.


I may have figured it out So don't worry!

I had a flag hidden in my code somewhere that was stopping my methods from firing. Sorry!

0

精彩评论

暂无评论...
验证码 换一张
取 消