Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Eraserhead

macrumors G4
Original poster
Nov 3, 2005
10,434
12,250
UK
Sorry for asking loads of questions recently :eek:, I really appreciate the help.

I have an issue when I have an NSView that I want to display in different places, what happens is that the second time you view the subview it fails to appear. I have created an example application that shows the problem. If you switch to the second tab view at the top (which also has a subview with the same view in it.) and then switch back to the first tab the subview has disappeared.

I'd like it still to appear in the first sub-tabview when switching back, what am I doing wrong so it doesn't appear, is there some documentation I need to read? No errors appear on the console.
 

Attachments

  • CustomView.zip
    40.2 KB · Views: 85

Eraserhead

macrumors G4
Original poster
Nov 3, 2005
10,434
12,250
UK
I have found a workaround, basically rather than just doing whats below to set the view to the new object,
Code:
[[tabView2 selectedTabViewItem] setView:theView];

I create a brand new tab view item, delete the old one and set the view to the brand new tab view item using this code:

Code:
NSTabViewItem *oldView=[tabView2 selectedTabViewItem];
NSTabViewItem *newView=[[NSTabViewItem alloc] init];
[newView setLabel:[oldView label]];
[tabView2 insertTabViewItem:newView atIndex:0];
[[tabView2 selectedTabViewItem] setView:theView];
[tabView2 removeTabViewItem:oldView];
 

Eraserhead

macrumors G4
Original poster
Nov 3, 2005
10,434
12,250
UK
OK, the new code isn't working, I have expanded the test case and it works when the view is a subview of the first set of tabs but not if it's a view of a subtab (even though the same code is used for both), I'm submitting a bug-report to Apple, unless I'm doing something stupid.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.