Pregunta

ahora estoy trabajando con cocos2d y diseño para agregar el controlador de navegación a mi aplicación cocos2d, entonces agrego el control de navegación a mi aplicación cuando hago clic en no pasar toque o evento a cocos2d

ahora estoy tratando de anular UINavigationController por agregar un nuevo nombre de clase nuevo es NavigationController y heredar de UINavigationController

en init llamo [super init]; todo parece estar bien

pero cuando intento agregar

- (BOOL)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSLog(@"Im overriding touch");
    return YES;

}



- (BOOL)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSLog(@"Im overriding touchMove");
    return YES;
}

no llama

¿Fue útil?

Solución

¿Por qué llama a los métodos ccTouchesBegan: withEvent: y ccTouchesMoved: withEvent: en lugar de los nombres originales? No tiene que cambiar los nombres de los métodos cuando subclasifica UINavigationController; en su lugar, debe mantener los mismos nombres y llamar a super en ellos, así como sea apropiado. Por ejemplo:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSLog(@"I'm overriding touch");
    [super touchesBegan:touches withEvent:event];
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSLog(@"I'm overriding move");
    [super touchesMoved:touches withEvent:event];
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top