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
Post a Comment