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] (
                <NSTextField: 0x13b770>
        )
                2008-08-20 11:04:21.076 ViewApp[35666:10b] (
        )

So it appears that the text field is getting removed immediately after it gets put in. Why is this?

Thanks,

Justin Giboney

On Aug 20, 2008, at 10:12 AM, 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
{
NSTextField *newTextField = [[NSTextField alloc] initWithFrame:NSMakeRect(5,5,17,50)];
   [newTextField setStringValue:text];
   [self addSubview: newTextField];
   //[self setNeedsDisplay:YES];
}

If I add the code above into the drawRect: method, it works just fine. I think I need the commented line, but whether it is commented or not, it doesn't work. What do I have to do to redraw the view with the text field?

Thank you,

Justin Giboney
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/graphics%40westernbotanicals.com

This email sent to [EMAIL PROTECTED]


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to