Re: Access object from another view
Re: Access object from another view
- Subject: Re: Access object from another view
- From: mmalc Crawford <email@hidden>
- Date: Tue, 21 Sep 2010 16:03:48 -0700
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#//apple_ref/doc/uid/TP40007457>
For general design guidelines etc. see <http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/CoreApplication/CoreApplication.html#//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 (email@hidden)
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:
This email sent to email@hidden