• 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: Why does this leak memory?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why does this leak memory?


  • Subject: Re: Why does this leak memory?
  • From: Matt Ball <email@hidden>
  • Date: Mon, 11 Jul 2005 11:55:56 -0400

With that code, the effect is still the same. When I double click to
edit, the cell's background becomes white, and the text is
highlighted, but I can't edit it or change the highlighted selection.
Also, are you sure that I need to set the new cell's image
immediately? My tableView's willDisplayCell: method deals with setting
images. Each row has a different image.

- Matt Ball

On 7/11/05, glenn andreas <email@hidden> wrote:
>
> On Jul 11, 2005, at 10:40 AM, Matt Ball wrote:
>
> > Interface:
> >
> > #import <Cocoa/Cocoa.h>
> >
> > @interface LayerCell : NSTextFieldCell
> > {
> >     NSImage *image;
> > }
> >
> > - (NSImage *)image;
> >
> > @end
> >
> > Implementation of NSCopying:
> >
> > - (id)copyWithZone:(NSZone *)zone
> > {
> >      NSCell *copy = [[[self class] alloc] init];
> >
> >      return copy;
> > }
>
>
> This does not implement copy correctly - the results are a new object
> that doesn't have an image, so it's not a copy of the original.
>
> You'll need to do something more like:
>
> - (id)copyWithZone:(NSZone *)zone
> {
>       LayerCell *copy = [[[self class] alloc] init];
>      [copy setImage: [self image]];
>       return copy;
> }
>
> Copy is suppose to have all the same value/properties/behavior that
> the original has, and so without this, all the later code that does
> things like:
>
> NSDivideRect (aRect, &imageFrame, &textFrame, 10 + [[self image]
> size].width, NSMinXEdge
>
> is going to fail because there  is no image for that copy (returning
> undefined values for -(NSSize) size).
>
>
>
>
> Glenn Andreas                      email@hidden
>   <http://www.gandreas.com/> wicked fun!
> Widgetarium | the quickest path to widgets
>
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Why does this leak memory? (From: Matt Ball <email@hidden>)
 >Re: Why does this leak memory? (From: Matt Ball <email@hidden>)
 >Re: Why does this leak memory? (From: Charilaos Skiadas <email@hidden>)
 >Re: Why does this leak memory? (From: Matt Ball <email@hidden>)
 >Re: Why does this leak memory? (From: Bob Ippolito <email@hidden>)
 >Re: Why does this leak memory? (From: j o a r <email@hidden>)
 >Re: Why does this leak memory? (From: Matt Ball <email@hidden>)
 >Re: Why does this leak memory? (From: j o a r <email@hidden>)
 >Re: Why does this leak memory? (From: Matt Ball <email@hidden>)
 >Re: Why does this leak memory? (From: glenn andreas <email@hidden>)

  • Prev by Date: Re: Cocoa-Java Bridge collapse
  • Next by Date: Re: Inserting Special Characters into a String
  • Previous by thread: Re: Why does this leak memory?
  • Next by thread: Re: Why does this leak memory?
  • Index(es):
    • Date
    • Thread