• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Crashing View
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Crashing View
      • From: Tom Marchand <email@hidden>
References: 
 >Crashing View (From: Tom Marchand <email@hidden>)

  • Prev by Date: Re: Crashing View
  • Next by Date: Re: Crashing View
  • Previous by thread: Re: Crashing View
  • Next by thread: Re: Crashing View
  • Index(es):
    • Date
    • Thread