• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Putting stuff into a tab view programmatically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Putting stuff into a tab view programmatically


  • Subject: Re: Putting stuff into a tab view programmatically
  • From: David Watanabe <email@hidden>
  • Date: Mon, 29 Oct 2001 02:44:24 -0800

On Sunday, October 28, 2001, at 04:12 PM, Sam Goldman wrote:

NSTextView *myTextView = [[NSTextView alloc] init];

I get the view of the NSTabView's first item (there is only one to start)
and place the NSTextView into it with this:

[[[tabView tabViewItemAtIndex:0] view] addSubview:myTextView];

Is that right? When I do that, nothing shows up. I have never tried anything
like this before, and don't really understand what a subview is. Am I going
about this in the right way?


Mucking with the view hierarchy (as you were with subviews) isn't necessary to accomplish what you're after.

You need to wrap each NSTextView inside an NSTabViewItem and then proceed to insert the NSTabViewItem into the NSTabView. It might look something like this:

NSTextView* myTextView = [[NSTextView alloc] init];
NSTabViewItem* tabViewItem = [[NSTabViewItem alloc] initWithIdentifier: @"whatever"];
[tabViewItem setView: myTextView];
[tabViewItem setLabel: @"The label that shows up in the tab"];

// now add it to the pre-existing NSTabView
[tabView addTabViewItem: tabViewItem];

// you might have to call [tabView setNeedsDisplay], but I'm not sure.


Dave


References: 
 >Putting stuff into a tab view programmatically (From: Sam Goldman <email@hidden>)

  • Prev by Date: Re: Rapid development with Project Builder...how?
  • Next by Date: Coding conventions
  • Previous by thread: Re: Putting stuff into a tab view programmatically
  • Next by thread: Re: Putting stuff into a tab view programmatically
  • Index(es):
    • Date
    • Thread