The answers here all say that pushViewController retains the given viewController but they don’t refer to a document that states this.
Question is how do they know that pushViewController will retain the given view controller? Can we assume that this convention is adhered to by all other classes that take your NSObject* derived object pointer?
Edit:
I need a stronger argument/proof than what the currently presented answers propose. For example the documentation about UIView::addSubview clearly states ‘This view is retained by the receiver’. Alternatively, if you intend to show that the received controller is retained by implication because the UINavigationController has the same semantics as a collection class, then show that it does, by showing that it uses one of the collection classes internally or referencing some documentation that states this. The documentation for pushViewController says that the given view controller is placed on the ‘navigation stack’ but nowhere does it say what class this stack is. In fact, looking at the definition in the header file of the UINavigationController, it looks like it’s not using a stack, but using NSMutableArray. If you’ve done a math’s degree and written proofs then you’ll understand the sort of intellectual rigor I’m looking for.
Because collections always own their items, and parents always own their children.
In a sense, the navigation controller is operating like a type of collection – a stack.
If the controller up and disappeared on the navigation controller – that would be a big problem.
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmPractical.html#//apple_ref/doc/uid/TP40004447-SW1