• 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
Newbish problem with adding NSView to NSWindow
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Newbish problem with adding NSView to NSWindow


  • Subject: Newbish problem with adding NSView to NSWindow
  • From: email@hidden
  • Date: Thu, 23 Oct 2003 13:34:25 -0400

Hi,

I created an NSWindow in IB and connected it to a class of mine. Now I am trying to a an NSTextField to it when it lanunches:

-(void)addTextField:
{
NSTextField* newTextField = [[NSTextField alloc] initWithFrame: NSMakeRect(0,0,100,100)];
[newTextField setBackgroundColor: [NSColor blackColor]];
[newTextField setEnabled: TRUE];
[newTextField setDrawsBackground: TRUE];
[newTextField setTextColor: [NSColor whiteColor]];
[newTextField setStringValue: @"AAAA"];
[[mainWindow contentView] addSubview: newTextField];
[newTextField setNeedsDisplay: YES];
}

If I try to call [mainWindow setContentView: newTextField] instead of adding it as a subview the result is the same. Nothing appears in the window. 'mainWindow' is a valid pointer to the main window of the app. I am sure it is something really stupid but I am a total newbie and I just don't see it. Any help is appreciated.

TIA,
Dusan

P.S. It seems that everything is concentrated on using IB for constructing UI. I can't find many resources about creating stuff programmatically. _______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Prev by Date: Re: Strange NSMatrix thread
  • Next by Date: Re: fixPrecomps problems
  • Previous by thread: Re: Strange NSMatrix thread
  • Next by thread: Re: fixPrecomps problems
  • Index(es):
    • Date
    • Thread