Wednesday, October 10, 2012

addSubView and pushViewController difference

For ios project, addSubView and PushViewController can be used to display a new view. However, they are quite different.

addSubView is a instance method of View class, and it adds a view item into itself. If the subview occupies the whole screen, then it has the same effect of display a new view.

pushViewController is a instance method if UINavigationViewController, so it can only be used on UINavigationViewController object, it has a better isolation than previous method, as it does not add the new view as a subview in the parent view.

No comments:

Post a Comment