P
P
Petrushka2015-03-10 01:47:42
Objective-C
Petrushka, 2015-03-10 01:47:42

Selectors in Objective-c?

Good day, tell me, how do selectors differ from methods?
I know that the selector is a pointer to the method, the selector is thrown as a parameter and you can call the hidden methods of the class with it, but what is the difference between the method?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
An, 2015-03-10
@petruska

The selector is the "name" of the method. Actually it's just a string.
Classic example: there is a class NSString and NSNumber. Each of them has intValue methods (methods are different, as you understand), but at the same time, objects of both the first class and the second will respond to the same selector @selector(intValue)
for completeness, it is better to look at the apple docks
https://developer. apple.com/library/mac/documentat...
https://developer.apple.com/library/mac/documentat...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question