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];
}
P.S. You're leaking memory here. Like all init methods, -
initWithFrame: returns an object that you own, so you're responsible
for releasing it. -addSubview retains newTextField, so this method
should call [newTextField release] or [newTextField autorelease].
I know your problem is the view going away too early, not that it
sticks around too long. But once you get that bug fixed you'll want
to fix the memory leak -- especially if you're creating tons of
subviews.
--Andy
_______________________________________________
Cocoa-dev mailing list ([email protected])
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]