Is willMoveToSuperview called (with nil) when remo

2019-06-22 12:16发布

If you implement willMoveToSuperview on a UIView subclass, is it guaranteed to be called (with nil) when removeFromSuperview is called on your view?

The docs say that the newSuperview parameter may be nil and that it's called "whenever the superview changes" but I'm not sure if I can interpret this to mean it will be called when the view is removed from its superview even when not being moved to a different superview.

1条回答
Deceive 欺骗
2楼-- · 2019-06-22 13:04

Whenever a view receives removeFromSuperview, and the view's superview was not already nil, the view will always do [self willMoveToSuperview:nil].

查看更多
登录 后发表回答