using native objective-c method for C callbacks -


i want callback objective c method c.

//c  int gameenginecallback(int buttontype,void (*callback)(void))  //using above function gameenginecallback(roundbutton,callback);  //this works fine want call objective c native method instead of static void callback(void){  } 

you can't pass objective c method in c callback prototype . u can redirect objective c function c call definition.

example

//add below line in public declaration of ivar

id myclass; // if ur not sure ur class name or u have redirect ur delegate class  or   yourclassname *instanceof class; //(no need create instance declartion)  

// before ur call fires assign value ur ivar in ur init definition

myclass = self ; or myclass = delegate; 

// use above ivar in c callback function

static void callback(void) {  [myclass function];   } 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -