Reputation: 662
I'm trying to build an NSTabView styled in the same way as it is in this NSPanel/NSWindow in iTunes. this pops up when you edit a track.
When I add NSTabview, it appears with a tinted and bordered rect
I've tried everything I can think of to remove this rect, or set it to transparent. Has any one found a solution to this? Any pointers in the right direction would be extremely helpful.
Upvotes: 1
Views: 583
Reputation: 662
here's a programmatic solution for anyone interested:
- (void)createViews {
// tabview
self.tabView = [NSTabView new];
self.tabView.tabViewType = NSNoTabsNoBorder;
self.tabView.controlSize = NSRegularControlSize;
// tabview items
self.detailsTabItemView = [BPBaseView new];
NSTabViewItem *detailItem = [NSTabViewItem new];
detailItem.view = self.detailsTabItemView;
self.artworkTabItemView = [BPBaseView new];
self.artworkTabItemView.backgroundColor = [NSColor colorWithHex:BPCharcoalLight];
NSTabViewItem *artworkItem = [NSTabViewItem new];
artworkItem.view = self.artworkTabItemView;
[self.tabView addTabViewItem:detailItem];
[self.tabView addTabViewItem:artworkItem];
// segment control
self.segmentControl = [NSSegmentedControl new];
self.segmentControl.segmentCount = 2;
[self.segmentControl setLabel:@"Details" forSegment:0];
[self.segmentControl setLabel:@"Artwork" forSegment:1];
self.segmentControl.action = @selector(segmentControlClicked:);
self.segmentControl.selectedSegment = 0;
[self segmentControlClicked:self.segmentControl]; // force first view to show
// add views
[self.bottomContainerView addSubview:self.segmentControl];
[self.bottomContainerView addSubview:self.tabView];
}
- (void)segmentControlClicked:(id)segmentControl{
NSInteger index = [segmentControl selectedSegment];
[self.tabView selectTabViewItemAtIndex:index];
}
Upvotes: 1
Reputation: 150
You can create a tabless NSTabView and then you can add a NSSegmentedControl to select the active tab.
Upvotes: 3