自己组装出objc_msgSend

如果了解objc_msgSend底层的机制的话,普通的objc_msgSend的函数调用,也可以自己组装=生成出来,比如:

...
// Set up a NSString with the contents "Hello World" from a C string
Class nsstring = objc_getClass("NSString");
SEL stringUTF8sel = sel_registerName("stringWithUTF8String:"); 
id hello = objc_msgSend(nsstring, stringUTF8sel, "Hello World\n"); 
...

results matching ""

    No results matching ""