开发者

remove from superview

开发者 https://www.devze.com 2023-04-02 10:13 出处:网络
am adding one view to another view and when I remove new view then which method of first view will called ?

am adding one view to another view and when I remove new view then which method of first view will called ?

here i try viewWillAppear but it doesn't call.

Can anyone tell me about this?

I add view like,

[self.view addSubview:newview.view];

and I remove remove this view by ,

[self.view removeFromSuperview];

can Somebody tell me which method will be call when removeFromSu开发者_StackOverflow社区perview.


Give viewDidAppear a shot. viewWillAppear is sketchy at best for certain scenarios.


If you are adding and removing a subview, viewWillAppear will not get called on the superView or other views in the superview. You need to use a navigation controller, modal view controller, or tab view controller in order for this to work as you expect. It seems like you should use a UINavigationController and use push/pop instead of add/remove.

0

精彩评论

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