Re: NSTabView
Re: NSTabView
- Subject: Re: NSTabView
- From: Graham Cox <email@hidden>
- Date: Thu, 12 Sep 2013 17:35:40 +0200
On 12/09/2013, at 5:25 PM, Joseph Ayers <email@hidden> wrote:
> I created a delegate procedure in the window controller
>
> - (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem
> {
> AppDelegate *appDelegate = [NSApp delegate];
> if (tabViewItem == [[appDelegate graphicsWindowController] scopeItem]){
> NSLog(@"Scope Item Selected");
> }
> else if (tabViewItem == [[appDelegate graphicsWindowController] graphItem]){
> NSLog(@"GraphItem Selected");
> }
>
> }
> That never gets called. Hence my question about the target action of the tabs. When I first create the oscilloscope tab the oscilloscope gets drawn,
> but if I then create a graphViewItem it draws a blank screen. If I then click on the oscilloscope tab, the oscilloscope image doesn't come back.
>
Are you sure it never gets called, or is it that neither statement is ever logged?
The NSTabViewItem is NOT the same object as the view it hosts, so your conditionals will always return false. [NSTabViewItem view] is the object you're looking for.
That said, the rest of your code (which is rather difficult to read) does not appear to be setting the view - or I may have missed it, or it might be being done in a method not shown here.
I've done this sort of thing a few times and it's fairly straightforward. You appear to be making heavy weather of it. All you need to do is to call -setView: for each tab view item with the views you want to add to the tab. It should do the rest.
--Graham
_______________________________________________
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