Your solution seems workable but very strange to me.
Why rotate the "dial" instead of rotating the coordinate system in
which the dial is drawn ?
Because the clock face and all it's parts are rendered in the same
view. If I rotate the view coordinates, the whole clock rotates not
just the hands.
You do not have to do all the view drawing in the same coordinate
system. Also repeatedly transforming the paths you are drawing does
not seem like the best approach. Better to save and restore graphics
state to draw the bits in different coordinate systems, so your
graphics model objects can be static. Your -drawRect would look
conceptually like this:
(other drawing in the view bounds coordinate system)
Also this is much simpler when you update on your timer fire, all you
have to do is make a new rotateTransform with the correct amount of
rotation to put the hands at the current time.
By the way, remember that NSTimer fires are never early but can be
arbitrarily late, so your 1-second tick may be sometimes 1.01 or 1.02
seconds, hence with the example code you posted the clock will
probably run slow.
Hope this helps!
Bob S.
_______________________________________________
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