> On Jan 13, 2015, at 9:25 PM, N!K <pu56ucl...@alumni.purdue.edu> wrote:
> 
> A breakpoint at the end of drawRect shows that it runs twice. After the 
> second pass, the view appears, as it should.
> Between passes, bounds is changed somehow, as shown by NSLog  at the start 
> and end of drawRect. 
> Since this will upset code that I will add later, I’d like to stop this. 

The view's being resized, probably as part of view layout. Ideally AppKit 
shouldn't draw the view before it gets to its final size, but maybe this is 
part of an animation, or maybe it's something that hasn't been optimized 100% 
in AppKit.

In general, you should not make assumptions about when and how often -drawRect: 
will be called. That's up to AppKit. Your job is just to draw the view when 
you're told to. 

You haven't said why the bounds change will upset your code; is the view being 
changed to the wrong size? That would be an actual problem, but it isn't 
related to being drawn multiple times. You'd need to look at the view 
constraints in your window to diagnose that.

—Jens
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to