• 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: Set a view's delegate using IB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Set a view's delegate using IB


  • Subject: Re: Set a view's delegate using IB
  • From: Quincey Morris <email@hidden>
  • Date: Tue, 06 Sep 2011 12:51:20 -0700

On Sep 6, 2011, at 12:20 , Luc Van Bogaert wrote:

> I've been struggling trying to set a viewcontroller (loaded by its own nib) as the delegate of another (main) viewcontroller's view in IB, while at the same time avoiding  'awakefromnib' being called twice on the former viewcontroller object, because of it being part of the latter viewcontroller's nib. I haven't succeeded so far, so I finally decided to use code. But, I'm still wondering if this is at all possible using IB. Any ideas?

It's not clear which of the 2 nib files contains the view controller. You first say it's "loaded by its own nib", then you say it's "part of the [main view controller's] nib". Which is it?

It's also not clear what the "this" is that you want to do using IB. Clearly, you can't use IB to prevent 'awakeFromNib' being called twice. Why do you care if 'awakeFromNib' is called twice, and if you care why don't you solve the problem it causes in 'awakeFromNib' itself (such as setting a flag to prevent your custom initialization being done twice), for which you're presumably writing code anyway?

Also, you can perhaps take the alternative path of overriding the view controller's 'loadView' instead of 'awakeFromNib'. That should be executed only once, although at a different point in the view life cycle.


_______________________________________________

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

  • Follow-Ups:
    • Re: Set a view's delegate using IB
      • From: Luc Van Bogaert <email@hidden>
References: 
 >Set a view's delegate using IB (From: Luc Van Bogaert <email@hidden>)

  • Prev by Date: Re: The best way to call Cocoa methods not implemented in previous versions of the SDK?
  • Next by Date: Re: using AppKit additions in background threads
  • Previous by thread: Set a view's delegate using IB
  • Next by thread: Re: Set a view's delegate using IB
  • Index(es):
    • Date
    • Thread