• 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: ask about sleep function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ask about sleep function


  • Subject: Re: ask about sleep function
  • From: Tim Trautmann <email@hidden>
  • Date: Sun, 28 Jul 2002 22:24:41 -0700

On 7/28/02 21:41, "Chong Hiu Pun" <email@hidden> wrote:

> In cocoa, is there a function similar to sleep? e.g I want the program to
> pause for 2 seconds.Thanks!

Even though I don't think it is a good idea using the sleep function in
Cocoa GUI apps. It will work just fine in Cocoa code. Give it a try IF this
is really what you want. Unless you are writing a non-GUI app, I doubt sleep
is what you are looking for and sleep will be detrimental to your user
experience.

Sleep suspends execution of your program for the specified amount of time.
Issuing a sleep in a GUI Cocoa Application will most definitely give you the
beach ball icon for the duration of your sleep and your GUI won't respond to
user actions until the execution of your program continues.

Without knowing what problem you are trying solve I can only speculate.
Maybe NSNotification, NSTimer or NSThread can help you solve it?

Tim
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: ask about sleep function
      • From: Ondra Cada <email@hidden>
    • Re: ask about sleep function
      • From: "Chong Hiu Pun" <email@hidden>
References: 
 >ask about sleep function (From: "Chong Hiu Pun" <email@hidden>)

  • Prev by Date: Cocoa Finder plugins
  • Next by Date: Re: ask about sleep function
  • Previous by thread: ask about sleep function
  • Next by thread: Re: ask about sleep function
  • Index(es):
    • Date
    • Thread