• 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: Cocoa view gets sluggish over time
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa view gets sluggish over time


  • Subject: Re: Cocoa view gets sluggish over time
  • From: Artemiy Pavlov <email@hidden>
  • Date: Mon, 20 Dec 2010 16:13:15 +0200

Richard, here is the code I am using, here x, y, i are variables that define the label position and text.

If I comment this snippet, my view is working well. So I am sure that there is something in these lines that needs to be done properly, which I don't know ;-)

NSTextField *PatternStepLabel = [[NSTextField alloc] initWithFrame:NSMakeRect(x, y, 20, 20)];
NSString *PatternStepLabelString = [NSString stringWithFormat:@"%d", i];

[PatternStepLabel setEditable:NO];
[PatternStepLabel setDrawsBackground:NO];
[PatternStepLabel setSelectable:NO];
[PatternStepLabel setBezeled:NO];
[PatternStepLabel setAlignment:2];
[PatternStepLabel setTextColor:StepColor];
[PatternStepLabel setStringValue:PatternStepLabelString];
[PatternStepLabel setFont:[NSFont fontWithName:@"Courier" size:8.0]];
[self addSubview:PatternStepLabel];

[PatternStepLabelString release];
[PatternStepLabel release];



On 20 Dec 2010, at 16:02, Richard Somers wrote:

Two suggestions.

One, you can verify that you are not leaking using one of the tools provided, Instruments or MallocDebug.

Two, I think you need to provide code examples for list members to provide constructive comments.

--Richard Somers

On Dec 20, 2010, at 6:31 AM, Artemiy Pavlov wrote:

I have a Cocoa view that reacts to -mouseDown and -mouseDragged events and then draws something via -drawRect method.

It has about 50 objects that are either NSBezierCurve or NSTextField. The problem is, after a few seconds of mouse dragging, the view becomes very sluggish. I release all of the NSTextField and NSString objects immediately after drawing them.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Cocoa view gets sluggish over time
      • From: aglee <email@hidden>
References: 
 >Cocoa view gets sluggish over time (From: Artemiy Pavlov <email@hidden>)
 >Re: Cocoa view gets sluggish over time (From: Richard Somers <email@hidden>)

  • Prev by Date: Re: Cocoa view gets sluggish over time
  • Next by Date: Re: Cocoa view gets sluggish over time
  • Previous by thread: Re: Cocoa view gets sluggish over time
  • Next by thread: Re: Cocoa view gets sluggish over time
  • Index(es):
    • Date
    • Thread