MultipleNibTabView example SOLVED
MultipleNibTabView example SOLVED
- Subject: MultipleNibTabView example SOLVED
- From: Boyd Collier <email@hidden>
- Date: Mon, 6 Mar 2006 22:00:25 -0800
Yesterday I posted the following message:
In the sample project MultipleNibTabView when the tab view first
appears, the view from EnterTex.nib is not displayed. The user
must first select the Select Colors tab and then the Enter Text
tab to get "Type here and press return" displayed, which doesn't
seem like it's the way things should work from a user's
perspective. I've tried to change the sample code so that the
contents of EnterTex.nib are displayed upon launch but haven't
succeeded in finding the right way to do this. If anyone can
provide what seems to be the missing code, I'd be very appreciative.
Greg Herlihy suggested that one of my files was corrupted, and he was
right. However, there's more to the story, and perhaps this note
will save another newcomer to cocoa (a class to which I belong) a lot
of time learning what I just learned. Or perhaps someone can point
to documentation that I overlooked (and which should be pointed out
in the readme file accompanying the MultipleNibTabView example).
In the nib MainMenu.nib of Apple's example, there is a tab view with
2 tabs, and the second of these, "Set Colors", is selected. I
inadvertently changed this to the first tab being selected in the
nib. The class WindowController has a method awakeFromNib that
contains [multipleNibTabView selectTabViewItemWithIdentifier:@"1"];
When this line of code is executed, the following gets executed if
and only if the first tab is not already set:
- (void)tabView:(NSTabView*)tabView didSelectTabViewItem:
(NSTabViewItem*)tabViewItem;
But if the above line isn't called when the tab view is loaded (and
it won't be if the first tab is selected in the nib), then the nib
EnterText doesn't get loaded. Only after the user selects the second
tab and then selects the first tab does the desired view get loaded.
Okay -- did I overlook something that I should have been aware of?
Boyd
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden