@selector() & _cmd

sdwebImage中的一种写法如下

@selector() & _cmd_第1张图片

此处有解释

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

你可能感兴趣的:(@selector() & _cmd)