Re: Crashing View
Re: Crashing View
- Subject: Re: Crashing View
- From: Sherm Pendley <email@hidden>
- Date: Sat, 7 Apr 2007 18:23:05 -0400
On Apr 7, 2007, at 6:00 PM, Tom Marchand wrote:
I've got a custom view that has a transparent background created
with colorWithDeviceRed. Everything works ok until I resize the
window, which results in the app crashing. Any help would be
appreciated. Here's the code:
- (id)initWithFrame:(NSRect)frameRect
{
if ((self = [super initWithFrame:frameRect]) != nil)
{
BackGround=[NSColor colorWithDeviceRed:.50 green:0.50 blue:.50
alpha:.50];
-colorWithDeviceRed:green:blue:alpha: is not +alloc or -copy. That
means it's your responsibility to retain the BackGround object if you
intend to use it later, and to release it when you're done using it.
//BackGround=[NSColor grayColor];
}
return self;
}
- (void)drawRect:(NSRect)rect
{
[BackGround set];
You're trying to send a -set message to an object that no longer exists.
[NSBezierPath fillRect:[self bounds]];
}
Have a look at:
<file:///Developer/ADC Reference Library/documentation/Cocoa/
Conceptual/MemoryMgmt/index.html>
Or online:
<http://developer.apple.com/documentation/Cocoa/Conceptual/
MemoryMgmt/index.html>
sherm--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden