Re: More on drawRect not getting called
Re: More on drawRect not getting called
- Subject: Re: More on drawRect not getting called
- From: Tom Jeffries <email@hidden>
- Date: Sun, 24 Jul 2011 11:41:28 -0700
Jens, I'm sorry if my naming conventions confuse you. I've been programming
for 27 years on a wide variety of operating systems, and I'm afraid
following Cocoa naming conventions is not high on my list.
I thought [SequeraStepWindow awakeFromNib] makes it obvious that
SequeraStepWindow is a class. Is there a way to use that syntax with a
variable? If so, Objective C gets a major thumbs down.
Draw Notes calls other routines to get the correct information and ends
with:
CGContextBeginPath (noteContext);
CGContextAddEllipseInRect(noteContext, noteBox);
CGContextFillPath(noteContext);
CGContextDrawPath(noteContext, kCGPathStroke);
drawRect is supposed to do the actual screen drawing. It does it perfectly
when called during program startup. It is not called again.
The program compiles without warnings. Obviously I dealt with that level
before posting a question here.
Thanks, Tom
On Sun, Jul 24, 2011 at 10:45 AM, Jens Alfke <email@hidden> wrote:
>
> On Jul 24, 2011, at 10:11 AM, Tom Jeffries wrote:
>
> + (BOOL) Play
>
>
> It’s hard to tell what’s going on in the code when you’re not following
> Cocoa naming conventions. Methods should start with a lowercase letter
> (unless they begin with a common acronym like “URL”).
>
> I’m very strongly in favor of prefixing (or postfixing) instance variables
> with something like “_” or “m_” to distinguish them from other variables.
> This makes it a lot easier to look at code and quickly identify what a
> variable is, as in these snippets. (It’s not a universal convention, though,
> although I will note that Apple strongly follows it in its own code.)
>
> [self DrawNotes]; // this is where the drawing takes place
>
>
> Do you mean that the -DrawNotes method actually draws stuff? It shouldn’t;
> that should happen in -drawRect:.
>
> //[SequeraStepWindow awakeFromNib];
>
> //[SequeraStepWindow setNeedsDisplay: YES];
>
>
> What is SequeraStepWindow? A class or a variable? It’s capitalized so I
> assume a class, but both of those are instance methods, so they won’t work
> when called on a class (and will generate compiler warnings.)
>
> * Does your code build without warnings? If not, fix the warnings first.
> Very important; a lot of serious errors in Obj-C only get reported as
> warnings.
> * Have you set an all-exceptions breakpoint? There are cases in which an
> exception thrown from your code can be caught by AppKit and not reported
> back to you, so it just looks as though nothing happens.
>
> This is getting messy enough that maybe you should just upload a zip file
> of your whole project, or at least the relevant source files, and post the
> URL...
>
> —Jens
>
_______________________________________________
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