• 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: Loops in Objective C?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Loops in Objective C?


  • Subject: Re: Loops in Objective C?
  • From: Nathan <email@hidden>
  • Date: Mon, 26 May 2008 15:35:37 -0400

I'm looking into NSTimer then. Thanks!

On May 26, 2008, at 3:30 PM, Thomas Davie wrote:


On 26 May 2008, at 21:30, Nathan wrote:

How do I redraw then?

On May 26, 2008, at 3:26 PM, Thomas Davie wrote:


I won't bother showing you the other files in the project I know they're all in order. So I want the object receiving sliderRotation to rotate, in the above code I want it to rotate forever. If I remove the loop, each time I press the button it rotates -.5 degrees. But with the loop in there, I get the horrible spinning beachball of eternity when I press the button and the object that is supposed to rotate never moves. Do I have to use some special Objective C loop?

No, no such thing, just your loop never modifies the value of z, so your program's execution never proceeds outside the loop. The GUI can't redraw if all your program is doing is looping infinitely.


Bob

You need to either spread your loop over the run loop, or run it on another thread. I'd suggest the earlier by having a timer fire a method off at regular intervals to update the control.


Bob

_______________________________________________

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: 
 >Loops in Objective C? (From: Nathan <email@hidden>)
 >Re: Loops in Objective C? (From: Thomas Davie <email@hidden>)

  • Prev by Date: Re: Loops in Objective C?
  • Next by Date: Re: assignment in if clause
  • Previous by thread: Re: Loops in Objective C?
  • Next by thread: Re: Loops in Objective C?
  • Index(es):
    • Date
    • Thread