Loading a nib
Loading a nib
- Subject: Loading a nib
- From: "john darnell" <email@hidden>
- Date: Wed, 11 Jun 2008 14:43:19 -0500
- Thread-topic: Loading a nib
Guys, this may be my third time posting this to the list. It's not
showing up in my Sent box using the previous two methods, so if this is
a duplicate message, once again I apologize.
Using Chapter 9 of Aaron Hillegass' book, COCOA PROGRAMMING FOR MAC OS
as a model, I attempted to create a very simple project: a window that,
at the click of a button, called up another, very simple window. The
button on the first window said "push me" and a small message in static
text that said, "you have pushed my button" was on the second, and
nothing else.No other methods are included in the project, and at the
risk of being redundant, let me say that the only other deviation from
the program as represented by the book is that the second window is a
window and not a panel, and it is not called forth when the user clicks
"Preferences," but when the above-mentioned button is clicked.The
salient AppController method looked like this:-(IBAction) showNewDialog:
(id) sender{ if(!newDialogController) { newDialogController =
[[NewDialogController alloc] init]; } [newDialogController
showWindow:self];}and the init function in NewDialogController looked
like this:- (id) init{ self = [super
initWithWindowNibName:@"NewDialogController"]; return self;}I
double-checked to ensure that the nib file really is called
NewDialogController (It is).I also overrode the windowDidLoad method to
print out NSLog(@"I loaded the NewDialogController nib file.");into the
Run log, in keeping with the spirit of the original project.Everything
compiled and the program executed just fine. I stepped through
showNewDialog and initWithWindowNibName so I know that that code is
being executed, but the second window never makes an appearance.
windowDidLoad is printing its message on queue to the Runlog, so I do
not know what is wrong.Does anyone have any ideas as to why this is
(not) happening?TIA,JohnP.S. A disclaimer and apology, if needed. I'm
slightly on drugs today (prescription, I promise) so I'm a little woozy.
If I have already submitted this to the community, I apologize.
R,
John A.M. Darnell
Team Leader
Walsworth Publishing Company
Brookfield, MO
John may also be reached at email@hidden
Trivia Question: In Alien Nation, George Francisco's son's Terran name
is Buck. How did he get his name?
_______________________________________________
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