@selector() & _cmd

sdwebImage中的一种写法如下

此处有解释

https://www.jianshu.com/p/fdb1bc445266

文档:

Declaration typedef struct objc_selector *SEL;

Description Defines an opaque type that represents a method selector.

Method selectors are used to represent the name of a method at runtime. A method selector is a C string that has been registered (or “mapped“) with the Objective-C runtime. Selectors generated by the compiler are automatically mapped by the runtime when the class is loaded.

You can add new selectors at runtime and retrieve existing selectors using the function sel_registerName.

When using selectors, you must use the value returned from sel_registerName or the Objective-C compiler directive @selector(). You cannot simply cast a C string to SEL.

MORE :apple-reference-documentation://hcYsf9mf-A

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 转至元数据结尾创建: 董潇伟,最新修改于: 十二月 23, 2016 转至元数据起始第一章:isa和Class一....
    40c0490e5268阅读 2,116评论 0 9
  • 一、SEL 类成员方法的指针 可以理解 @selector()就是取类方法的编号,他的行为基本可以等同C语言中的函...
    _Lily阅读 5,058评论 0 7
  • 前言: unrecognized selector类型的crash是因为一个对象调用了一个不属于它的方法导致的。要...
    盗梦49阅读 1,013评论 0 4
  • 在我们iOS开发过程中遇到很多@selector,特别是在按钮点击事件中都有@selector()这个方法,下面简...
    Senjougahara阅读 2,192评论 0 4
  • 之前去XXXX公司面试被问到“怎样使用performSelector传入3个以上参数,其中一个为结构体?”当时年少...
    Miu七七阅读 8,048评论 2 16

友情链接更多精彩内容