• 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
Multiple Nib Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Multiple Nib Question


  • Subject: Multiple Nib Question
  • From: Joseph Crawford <email@hidden>
  • Date: Wed, 28 Jan 2009 14:04:04 -0500

Hello Everyone,

I had my project all working smooth using 1 nib file which contained my MainMenu and my window. I have since separated them because a lot of people suggested it. However this separation has led me to hit an issue.

In my ManManu nib I have my App Delegate which then loads my window by instantiating the instance of my WindowController which displays the window.

The issue is this. The application will copy sample files over to my application support directory (AppController) and also the SidebarController needs to be able to read this directory. I have the following method in my AppController

- (NSString *)appSupportFolder {

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex: 0] : NSTemporaryDirectory();
return [basePath stringByAppendingPathComponent:@"TomTom POI Manager"];
}


As you can see this just determines the path to the users Application Support folder and returns that path.

My issue is that this method is in the AppController class which is in my MainMenu nib. In my MainWindow nib I have a method that is trying to call the above method through an outlet to AppController, however since AppController is in another nib I cannot make the connection.

What would be the best way to solve this issue?

My thoughts are this.

1.) duplicate code across multiple nibs (not a good idea)
2.) create a class method (not sure this is the best answer either)
3.) in AppDelegate when the [[MainWindowController alloc] init] method is called, call initWithAppSupportPath:path so that the window controller gains knowledge of the path


Are any of the above a good method to use, do you have any alternative suggestions?

I am familiar with encapsulation in classes but this while multiple nib process is new for me.
If you can suggest any reading I would be more than willing to read for the answer as well


Thanks,
Joseph Crawford
_______________________________________________

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: Multiple Nib Question
      • From: Michael Ash <email@hidden>
    • Re: Multiple Nib Question
      • From: Jonathan Hess <email@hidden>
    • Re: Multiple Nib Question
      • From: "email@hidden" <email@hidden>
  • Prev by Date: Drag and drop from NSCollectionView
  • Next by Date: Re: Multiple Nib Question
  • Previous by thread: Re: Drag and drop from NSCollectionView
  • Next by thread: Re: Multiple Nib Question
  • Index(es):
    • Date
    • Thread