Stanford University, CS193p, Lecture 3, Page 45
I read this too
The Objective-C Programming documentation, Selectors
Still can’t understand any of both
Can someone explain it more clearly? It would be better if it’s in a C/C++ way 🙂
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In short: it’s a method name.
In Objective-C, a method call works differently than in, say, C++. Ever method call in Objective-C really is a call to the C function
objc_msgSendor a variant of it. This function then decides how to actually make the method call. The first argument to this function is the object pointer (self), the second is the selector (_cmd, the method name). Additional arguments are the method arguments. Nowobjc_msgSendlooks up which compiled method needs to be called for the selector and then jumps to it. So the selector “selects” which method of the object gets called.