Handling Callbacks

后端 未结 3 548
花落未央
花落未央 2021-02-04 20:00

I have a method in an objective-C class. It has 2 callback functions written in C. The class pointer i.e. self is passed to these functions as void *.

3条回答
  •  独厮守ぢ
    2021-02-04 20:05

    This is what Objective-C's selector is for: http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/NSInvocationOperation_Class

    The API isn't very intuitive, but its fine once you understand it

    You might need to do some refactoring as well, now there might be a better way, but when I had this problem my solution was to refactor and use InvoationOperation.

提交回复
热议问题