开发者

iOS removeFromSuperview if not added to superview doesn't throw an error

I tried开发者_JAVA技巧 removeFromSuperview on a view that had not been added as a subview but Xcode 4 didn't throw any error. Is this expected behaviour?


First off, Xcode 4 wouldn't do anything at all. That's the IDE. It has nothing to do with the runtime behavior of your app.

Secondly, the documentation for -removeFromSuperview states

If the receiver’s superview is not nil, the superview releases the receiver.

What part of this would lead you to expect -removeFromSuperview to throw an exception if the view has no superview?

In any case, the answer is yes, this is normal. -removeFromSuperview does not throw exceptions.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜