• 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: NIB loading cycle? (sequel to: Dynamically loading NIB files with a common stem)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NIB loading cycle? (sequel to: Dynamically loading NIB files with a common stem)


  • Subject: Re: NIB loading cycle? (sequel to: Dynamically loading NIB files with a common stem)
  • From: Ken Thomases <email@hidden>
  • Date: Wed, 06 Jul 2011 09:15:44 -0500

On Jul 6, 2011, at 9:08 AM, Vincent Habchi wrote:

> implementing Alexander's idea, I wrote this code to load Nibs ending with "Connector":
>
> - (void)fetchAndInitializeConnectors {
> 	// Search all NIB files ending with "connector" and load them
> 	for (NSString * path in [[NSBundle mainBundle] pathsForResourcesOfType:@"nib" inDirectory:@"."]) {
> 		NSString * name = [[path lastPathComponent] stringByDeletingPathExtension];
> 		if ([name hasSuffix:@"Connector"]) {
> 			[NSBundle loadNibNamed:name owner:self];
> 		}
> 	}
> }
>
> However, I end up in a cycle, whereby the call to [NSBundle loadNibNamed:name owner:self] generates a (unexpected) callback to -awakeFromNib. How come? Is this normal behavior?
>
> This is not the case if I substitute nil to self in [NSBundle loadNibNamed:name owner:self];

The NIB's owner is effectively an object in the NIB, via the File's Owner stand-in.  Therefore, it gets an -awakeFromNib call.

Regards,
Ken

_______________________________________________

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: 
 >NIB loading cycle? (sequel to: Dynamically loading NIB files with a common stem) (From: Vincent Habchi <email@hidden>)

  • Prev by Date: Re: NSDatePicker weirdness with time.
  • Next by Date: Re: Delay in reading cookie using NSHttpCookieStorage
  • Previous by thread: NIB loading cycle? (sequel to: Dynamically loading NIB files with a common stem)
  • Next by thread: Re: NIB loading cycle? (sequel to: Dynamically loading NIB files with a common stem)
  • Index(es):
    • Date
    • Thread