管理CCLayer们的Touch

来源:转载

当CCLayer中含有CCMenu时, 仅仅设置self.isTouchEnable是不够的,这时通常需要这样开关CCLayer的触控

- (void)openTouch {

for (id child in [self children]) {

if ([child isKindOfClass:[CCMenu class]]) {

for (CCMenuItem *item in [child children]) { [item setIsEnabled:YES];
}
}
}
self.isTouchEnabled = YES;
}

- (void)closeTouch {
for (id child in [self children]) {
if ([child isKindOfClass:[CCMenu class]]) {
for (CCMenuItem *item in [child children]) {
[item setIsEnabled:NO];
}
}
}
self.isTouchEnabled = NO;
}


分享给朋友:
您可能感兴趣的文章:
随机阅读: