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

View Single Post
Old 08-22-2010, 08:51 PM   #1 (permalink)
Russell
Registered Member
 
Join Date: Aug 2010
Posts: 2
Russell is on a distinguished road
Default I don't understand the concept of selectors

I don't understand the details of why and how to use selectors in objective -c. I understand that at runtime messages are 'converted' to selectors. But I don't understand why I should use them in practice. For example what is the purpose of calling the animateBall method in the initializerTimer method using a selector?


-
Code:
(void)animateBall:(NSTimer *)theTimer {

	ball.center = CGPointMake(ball.center.x +ballMovement.x,
		ball.center.y + ballMovement.y);
}

-
Code:
(void)initializeTimer
{
	float theInterval = 1.0/30.0;
	[NSTimer scheduledTimerWithTimeInterval:theInterval target:self selector:@selector(animateBall:) userInfo:nil repeats: YES];

}
Russell is offline   Reply With Quote
 

» Advertisements
» Online Users: 373
9 members and 364 guests
heshiming, iGamesDev, ipodphone, larhondaxzcw, linkmx, Matl43Owa, Renechris, TunaNugget
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,577
Threads: 94,082
Posts: 402,757
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Renechris
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 12:19 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.