Newbish problem with adding NSView to NSWindow
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.