Accessing objects on one nib file from another nib file

Posted by ASN on Stack Overflow See other posts from Stack Overflow or by ASN
Published on 2010-06-18T07:36:13Z Indexed on 2010/06/18 7:43 UTC
Read the original article Hit count: 320

Filed under:

I have two nib files Main.nib and Preferernces.nib I have a class CalendarView.m that inherits from NSView .It has a method for drawing calendar - (void)drawCalendar; In Main.nib window I have NSWindow(My Main window) which has an NSView item on it for displaying calendar.Main window has an NSPopUp button that shows a menu when application runs. Menu has a 'Preferences' menu item which on clicking show a preferences panel(NSPanel) that panel is in Preferences.nib file.Panel has a colorwell item .When application is executed clcking on colorwell show a color panel to choose color .But I am unable to apply that color to my calendar. I have another class PreferencesWindowController.m that shows preferences panel . It has a method changeColor that takes selected color from colors panel and make changes to user defaults . I have IBOutlet CalendarView *calView as a member in PreferencesWindowController.h class.

In changeColor mehod I am writing -

calView = [[CalendarView alloc] init]; [calView drawCalendar];

On debugging call goes to drawCalendar method of CalendarView but skips some part of it and
goes to end of function without redrawing. On restarting the application color is applied but I want it to happen while application is executing, so that there is no need to rerun the application to view changes.

© Stack Overflow or respective owner

Accessing objects on one nib file from another nib file

Posted by ASN on Stack Overflow See other posts from Stack Overflow or by ASN
Published on 2010-06-18T07:12:14Z Indexed on 2010/06/18 7:33 UTC
Read the original article Hit count: 320

I have two nib files - Main.nib and Preference.nib In Main.nib file I have an instance of NSView class.Its window has a NSPopUpButton which on clicking shows a menu .In the menu I have show Preferences menu item. Menu item on clicking shows a preferences panel containing a color well item. On clicking color well a color panel is displayed to choose the color. The problem is how to apply that color to main application window.

My preference panel window is in Preference.nib file. So problem is accessing NSView from another Nib Window.

Is there a way so that I can make connection between preference panel and my main application window(NSView)

© Stack Overflow or respective owner

Related posts about objective-c