Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > Mac OS X Development Forums > Objective-C, Python, Ruby Development

Reply
 
LinkBack Thread Tools Display Modes
Old 04-21-2011, 09:16 AM   #1 (permalink)
Registered Member
 
Join Date: Apr 2011
Posts: 6
christatedavies is on a distinguished road
Default How to automatically run a function

Hello. This is probably very simple for you guys to answer, but can't seem to find the answer anywhere.

I have a timer that I want to run a function every second. This is fine, all the functions are written. However, I seem to have to put the timer initialisation code into a function.

The code is:

Code:
[NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(checkForSunset) userInfo:nil repeats:YES];
How do I get it to run when the view loads? Like in VB, form_load or something similar...

I would imagine its basic C methodology, but I am a PHP developer and its a tough learning curve for me!

Thanks in advance.

Chris
christatedavies is offline   Reply With Quote
Old 04-25-2011, 03:42 AM   #2 (permalink)
Registered Member
 
Joe-Kinglake's Avatar
 
Join Date: Mar 2011
Posts: 128
Joe-Kinglake is on a distinguished road
Default

I believe you are looking for the viewDidLoad function.
__________________
--------------------------------------------
Our Site
http://www.iworldapps.net/

Like Us On Facebook
http://on.fb.me/fcxiIZ



--------------------------------------------
Joe-Kinglake is offline   Reply With Quote
Old 04-26-2011, 05:00 AM   #3 (permalink)
Registered Member
 
Join Date: Apr 2011
Posts: 6
christatedavies is on a distinguished road
Default

Quote:
Originally Posted by Joe-Kinglake View Post
I believe you are looking for the viewDidLoad function.
Exactly what I was looking for. Thank you very much Joe.
christatedavies is offline   Reply With Quote
Reply

Bookmarks

Tags
functions, noob!, timer

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 479
16 members and 463 guests
7twenty7, AlanFloyd, AppsBlogger, David-T, HemiMG, iAppDeveloper, imac74, Jaxen66, lovoyl, Music Man, mutantskin, Paul Slocum, SLIC, solardrift, unicornleo, usernametaken
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,683
Threads: 94,131
Posts: 402,932
Top Poster: BrianSlick (7,990)
Welcome to our newest member, unicornleo
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:14 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0