Hi,
I've read the apple document on obj-c @selector but the concept the selector is still pretty unclear. So far i think its somewhat like a callback?? but I might be wrong. So could anyone give me a better explaination?
THanks :)
A fast, easy to use, free, and community supported 2D game engine
Hi,
I've read the apple document on obj-c @selector but the concept the selector is still pretty unclear. So far i think its somewhat like a callback?? but I might be wrong. So could anyone give me a better explaination?
THanks :)
It's a callback. Like in MenuItems - each one can have selector and when the item is selected, the selector method (the callback) is called. No parameters can be passed as far as I can tell.
You can pass parameters when calling a selector. NSObject for example has the methods:
-performSelector:
-performSelector:withObject:
-performSelector:withObject:withObject:
How would you do a menuItem selector method that accepts something like an int? I remember trying but never got it to work.
Here is an interesting writeup on callbacks and objective C. (Callbacks are not native to objective C)
http://borkwarellc.wordpress.com/2007/09/13/c-callbacks-in-objc/
You must log in to post.