On Sep 21, 2010, at 2:49 pm, Steve Wetzel wrote:

> Then [self.view addSubView:viewController2.view]; brings up the subview.
> 
You should [almost certainly] not be doing this.
If you want to display another view controller's view, you should use an 
appropriate technique to present the view controller itself. In many case this 
would involve using a navigation controller (UINavigationController).

To learn more about application architecture using view controllers, read the 
View Controller Programming Guide 
<http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/Introduction/Introduction.html%23//apple_ref/doc/uid/TP40007457>
For general design guidelines etc. see 
<http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/CoreApplication/CoreApplication.html%23//apple_ref/doc/uid/TP40007072-CH3-SW14>

To address the general question of "how do I access an object from another 
view": As you appear to be asking it, you don't.
The general pattern is that before you present a view, you pass to its view 
controller any data that will be needed for display. It's up to the view 
controller to then project the relevant information into its view.

mmalc

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to