selector是方法名,message包括selector和方法的参数,method包括selector和方法的具体实现。
以下转自stackoverflow: http://stackoverflow.com/questions/5608476/whats-the-difference-between-a-method-and-a-selector
-
Selector - a Selector is the name of a method. You're very familiar with these selectors:
alloc
,init
,release
,dictionaryWithObjectsAndKeys:
,setObject:forKey:
, etc. Note that the colon is part of the selector; it's how we identify that this method requires parameters. Also (though it's extremely rare), you can have selectors like this:doFoo:::
. This is a method that takes three parameters, and you'd invoke it like[someObject doFoo:arg1 :arg2 :arg3]
. There's no requirement that there be letters before each part of the selector components. As I said, this is extremely rare, and you will not find it used in the Cocoa frameworks. You can work with selectors directly in Cocoa. They have the typeSEL
:SEL aSelector = @selector(doSomething:)
orSEL aSelector = NSSelectorFromString(@"doSomething:");
-
Message - a message is a selector and the arguments you are sending with it. If I say
[dictionary setObject:obj forKey:key]
, then the "message" is the selectorsetObject:forKey:
plus the argumentsobj
andkey
. Messages can be encapsulated in anNSInvocation
object for later invocation. Messages are sent to a receiver. (ie, the object that "receives" the message). -
Method - a method is a combination of a selector and an implementation (and accompanying metadata). The "implementation" is the actual block of code; it's a function pointer (an
IMP
). An actual method can be retrieved internally using aMethod
struct (retrievable from the runtime).
相关推荐
在simulink上进行BusCreator和BusSelector的简单实验
Selector
Flutter的file_selector插件可以帮助开发者在移动应用中方便地选择文件。 要使用file_selector插件,首先需要将插件的依赖项添加到pubspec.yaml文件中,并运行flutter pub get命令获取插件的最新版本。 在插件使用...
探索Android中selector和shape的结合使用
一个强大的selector注入器,它可以让view自动产生selector状态,免去了你写selector的麻烦。
用selector设置button可用和不可用的样式
Android selector 完整demo
selenium css selector 定位详解
http://blog.csdn.net/zhufuing/article/details/20134255博客的demo下载
CSS Selector 生成器
Contact Selector 联系人选择器,选择联系人,Choose Contact,Contact,Contact select
带圆角的selector
selectorgadget插件,R语言爬取网页
Objective-C语言中方法的传递有二种:①Selector ② Blocks,本文主要说一下Selector,关于Blocks会在后续总结一下。 消息传递模型(Message Passing)是Objective-C语言的核心机制。在Objective-C中,没有方法调用...
android开发中,selector的代码实现。
java selector 测试并发.多线程并发。
Contact Selector在infopath中的使用!
Laravel开发-selector 选择器模式抽象类,用于管理用户级或运行时参数上的多态性。
第 1 章,也就是本章 ...第 3 章,类的声明和定义 第 4 章,继承 第 5 章,Class 类型,选择器 Selector 以及函数指针 第 6 章,NSObject 的奥秘 第 7 章,对象的初始化以及实例变量的作用域 第 8 章,类方法以及私有方法
一个关于SocketChannel、ServerSocketChannel、Selector的综合案例