¡@

Home 

2014/10/15 ¤U¤È 10:11:23

iphone Programming Glossary: methodforselector

performSelector may cause a leak because its selector is unknown

http://stackoverflow.com/questions/7017281/performselector-may-cause-a-leak-because-its-selector-is-unknown

be ignored and it's easy to work around. Here's how SEL selector NSSelectorFromString @ someMethod IMP imp _controller methodForSelector selector void func id SEL void imp func _controller selector Or more tersely though hard to read SEL selector NSSelectorFromString.. selector Or more tersely though hard to read SEL selector NSSelectorFromString @ someMethod void id SEL _controller methodForSelector selector _controller selector Explanation What's going on here is you're asking the controller for the C function pointer.. the controller for the C function pointer for the method corresponding to the controller. All objects respond to methodForSelector and it works through some lower level Objective C runtime methods so you could do this directly with the runtime API as..