Re: Simple NSView Question

2008-08-20 Thread Justin Giboney
Thanks for the help. For some reason I pulled a custom view onto the screen and also pulled an object over to the file (instantiating an object). I connected the outlet to that instead of the view in the window. I don't know what I was thinking. Works well now. Thanks Justin Giboney On Au

Re: Simple NSView Question

2008-08-20 Thread Andy Lee
On Aug 20, 2008, at 12:12 PM, Justin Giboney wrote: - (void)addLabelWithText:(NSString *)text { NSTextField *newTextField = [[NSTextField alloc] initWithFrame:NSMakeRect(5,5,17,50)]; [newTextField setStringValue:text]; [self addSubview: newTextField]; //[self setNeedsDisplay:YES];

Re: Simple NSView Question

2008-08-20 Thread Andy Lee
On Aug 20, 2008, at 1:28 PM, Justin Giboney wrote: This is assuming, of course, that you have a good reason for adding the subviews in code rather than in the nib file in the first place -- perhaps because your view layout is dynamic in some way and can't be decided until launch time? Yes

Re: Simple NSView Question

2008-08-20 Thread Justin Giboney
Here are my comments: If I add the code above into the drawRect: method, it works just fine. Technical questions would be so much clearer if we could remove "works" and "doesn't work" from the English language. :) By "works" do you mean it compiles? It runs without crashing? By "works

Re: Simple NSView Question

2008-08-20 Thread Andy Lee
On Aug 20, 2008, at 12:12 PM, Justin Giboney wrote: I think that I am really close to this... but I can't find the next step. I am trying to build a view programatically after the application has launched. So I have a custom view that has one method: - (void)addLabelWithText:(NSString *)text

Re: Simple NSView Question

2008-08-20 Thread Justin Giboney
I just noticed something. If I put NSLog(@"%@", [self subviews]); into the drawRect: method, I get the following out put right after the app loads 2008-08-20 11:04:21.059 ViewApp[35666:10b] ( ) 2008-08-20 11:04:21.076 ViewApp[35666:10b]

Simple NSView Question

2008-08-20 Thread Justin Giboney
I think that I am really close to this... but I can't find the next step. I am trying to build a view programatically after the application has launched. So I have a custom view that has one method: - (void)addLabelWithText:(NSString *)text { NSTextField *newTextField = [[NSTextField allo