Accessing objects on one nib file from another nib file
- by ASN
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.