J'ai une classe cpp comme ça ..appel méthode objective c de méthode cpp
class MyContactListener : public b2ContactListener
{
int countContact;
///this is an objective c class...
HelloWorld *hel;
public:
void EndContact(b2Contact* contact)
{
///initialize objective c object
hel=[[HelloWorld alloc] autorelease];
///call objective c method.........
[hel beginContact];
}
};
dans la classe cpp j'appelle un objectif c method.the méthode objective c ressemble ..
-(void)beginContact
{
shakeCounter++;
[_label setString:[NSString stringWithFormat:@"%d",shakeCounter]];
}
L'objectif c méthode est appelée .... et aussi la variable shakeCounter a augmenté ..... mais _label chaîne n'est pas mise à jour .... label est initialisé correctement et fonctionne correctement si j'ai appelé la méthode objective c de l'objectif c classe en utilisant soi ....
Quelqu'un peut-il aider ???
Veuillez 'NSLog (@"% @ ", _label);' après 'shakeCounter ++;' et afficher la sortie. – kennytm
Cette question est en relation avec [Impossible d'appeler une méthode Objective C à partir d'une fonction C] (http://stackoverflow.com/questions/304885/unable-to-call-an-objective-c-method-from-ac- fonction). – kiamlaluno
oui .... j'ai vu ceci et j'ai obtenu la null .... – Rony