• 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: Where do these come from...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where do these come from...


  • Subject: Re: Where do these come from...
  • From: Graham Cox <email@hidden>
  • Date: Thu, 16 Aug 2012 17:46:02 +1000

On 16/08/2012, at 1:02 PM, Charlie Dickman <email@hidden> wrote:

> Here's the whole method... it is being called from within a view's drawRect method...
>
> 	iDie = iRand(1, 6);



This is also nuts (though unrelated to your problem). You will get a new random value every time your view draws. It will be drawn at all sorts of times, not just when you invalidate the view yourself. If this value needs to be used elsewhere, it's not going to be stable.

Separate your MODEL (the die value) from the VIEW (how that die is visualised). Do it now. This is the path of insanity. When I see sloppy coding like this it throws the whole thing into doubt, and so a situation where you have an invalid context arising is no surprise.

--Graham




_______________________________________________

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

References: 
 >Where do these come from... (From: Charlie Dickman <email@hidden>)
 >Re: Where do these come from... (From: "Stephen J. Butler" <email@hidden>)
 >Re: Where do these come from... (From: Charlie Dickman <email@hidden>)

  • Prev by Date: Re: Mountain Lion crashes Simulator
  • Next by Date: Re: Classes incompatible with weak references
  • Previous by thread: Re: Where do these come from...
  • Next by thread: Re: Where do these come from...
  • Index(es):
    • Date
    • Thread