• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Access object from another view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Access object from another view (From: Steve Wetzel <email@hidden>)
 >Re: Access object from another view (From: Conrad Shultz <email@hidden>)
 >Re: Access object from another view (From: Steve Wetzel <email@hidden>)
 >Re: Access object from another view (From: Steve Wetzel <email@hidden>)

  • Prev by Date: Re: Access object from another view
  • Next by Date: Re: Access object from another view
  • Previous by thread: Re: Access object from another view
  • Next by thread: Re: Access object from another view
  • Index(es):
    • Date
    • Thread