• 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: Refresh
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Refresh


  • Subject: Re: Refresh
  • From: Joe Maffia <email@hidden>
  • Date: Thu, 10 Feb 2005 22:25:27 +0100

mhhh I tried, but no good results...

the problem is:
my app take a shot of the screen and send it via socket, so the same app on other machine receive it via rendezvous...

I'm successful to run, but the problem is that any refresh the app must be:
- resolve the address
- connect with socket and NSNotification
- catch the image...

not good ....

any other suggest for me?



Il giorno 10/feb/05, alle 20:48, Todd Yandell ha scritto:

Hi,

You just need to setup a timer that will refresh your view every few seconds. This is done with the NSTimer class. Basically, you need to set up a timer with a certain interval as your refresh rate, give it a selector (function pointer) and then schedule the timer with your run loop. Or, for convenience, the scheduledTimerWithTimeInterval:target:selector:userInfo:repeats: method will handle all of that for you. Here's an example:

<x-tad-bigger>- (</x-tad-bigger><x-tad-bigger>void</x-tad-bigger><x-tad-bigger>)awakeFromNib
{
</x-tad-bigger><x-tad-bigger>// Setup a three-second timer than calls 'refresh:'.</x-tad-bigger><x-tad-bigger>
</x-tad-bigger><x-tad-bigger>// The 'timer' should be an NSTimer instance variable.</x-tad-bigger><x-tad-bigger>


timer = [[NSTimer scheduledTimerWithTimeInterval:</x-tad-bigger><x-tad-bigger>3.0</x-tad-bigger><x-tad-bigger>
target:</x-tad-bigger><x-tad-bigger>self</x-tad-bigger><x-tad-bigger> selector:</x-tad-bigger><x-tad-bigger>@selector</x-tad-bigger><x-tad-bigger>(refresh:)
userInfo:</x-tad-bigger><x-tad-bigger>nil</x-tad-bigger><x-tad-bigger> repeats:</x-tad-bigger><x-tad-bigger>YES</x-tad-bigger><x-tad-bigger>] retain];
}

- (</x-tad-bigger><x-tad-bigger>void</x-tad-bigger><x-tad-bigger>)dealloc
{
[timer invalidate]; </x-tad-bigger><x-tad-bigger>// Stop the Timer</x-tad-bigger><x-tad-bigger>
[timer release]; </x-tad-bigger><x-tad-bigger>// Release the Timer</x-tad-bigger><x-tad-bigger>
[</x-tad-bigger><x-tad-bigger>super</x-tad-bigger><x-tad-bigger> dealloc];
}

- (</x-tad-bigger><x-tad-bigger>id</x-tad-bigger><x-tad-bigger>)sender
{
</x-tad-bigger><x-tad-bigger>// Reload Image Here</x-tad-bigger><x-tad-bigger>
}
</x-tad-bigger>


JPEG image


Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Refresh
      • From: Guy English <email@hidden>
References: 
 >Refresh (From: Joe Maffia <email@hidden>)
 >Re: Refresh (From: Todd Yandell <email@hidden>)

  • Prev by Date: NSUserDefaults example?
  • Next by Date: Re: NSUserDefaults example?
  • Previous by thread: Re: Refresh
  • Next by thread: Re: Refresh
  • Index(es):
    • Date
    • Thread