• 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
create a view without IB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

create a view without IB


  • Subject: create a view without IB
  • From: Andrea Salomoni <email@hidden>
  • Date: Tue, 20 Dec 2005 00:52:36 +0100

Hi and thank you,

The problem is this:

I have a nstabview created with ib and correctly connected.
When I click a certain button I would like to add a nstabviewitem (already done) and put inside it a nstextview.
To do it I made a new nib file with IB, created a class and put inside this view the textfiled.
Now, there isn't any problem when I instatiate this object with IB using the placeholder outlet, but when I need to create the placeholer (or better a new nsview object) starts the problems...
As you can see in my code:

// setting up interface
theChatView = [[privateChat alloc]init];
Create the object that contains nstextview
[[theChatView mainView] setFrame:[placeholder bounds]];
here I have to create the placeholder in other way... don't know how maybe
NSView * newPlaceholder = [[NSView alloc]initWithFrame:.....];
[[theChatView mainView] setFrameOrigin:NSZeroPoint];
[placeholder addSubview:[theChatView mainView]];
[_allMyViews addObject:theChatView];
[privateChat release];

This is my doubt...
Thank you all
Andrea

On 19/dic/05, at 21:07, Uli Kusterer wrote:

Am 19.12.2005 um 19:14 schrieb Andrea Salomoni:
// setting up interface
theChatView = [[privateChat alloc]init];
[[theChatView mainView] setFrame:[placeholder bounds]];
[[theChatView mainView] setFrameOrigin:NSZeroPoint];
[placeholder addSubview:[theChatView mainView]];
[_allMyViews addObject:theChatView];
[privateChat release];

The problem is placeholder outlet that I cannot use, because the NSView (placeholder) must be created without IB!

I'm not sure what you're trying to do that doesn't work. Just as you can create an object of any other class, you can also create an NSView using alloc/init (or rather, -initWithFrame:). Outlets are only needed for IB, otherwise just use a regular instance variable in your class.

To add a view to a tab view item, you have to create the NSTabViewItem and add it to your NSTabView and then set its view to your NSView using its setView: method. There's really not much to it.

Does that address your problem?

Cheers,
-- M. Uli Kusterer
http://www.zathras.de




_______________________________________________
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
  • Follow-Ups:
    • Re: create a view without IB
      • From: Shawn Erickson <email@hidden>
  • Prev by Date: Re: NSBundle dynamic loading problem
  • Next by Date: RE: XCode and subversion
  • Previous by thread: Re: Moire X v2.0 released, feedback would be appreciated
  • Next by thread: Re: create a view without IB
  • Index(es):
    • Date
    • Thread