【发布时间】:2012-02-19 14:33:52
【问题描述】:
希望任何人都可以帮助我。 我试图弄清楚在方法调用中传递了指向对象的指针。
所以(在 cocos2d 环境中)应该是这样的:
- (void)loadCreature:(CCSprite*)creature
{
if (/*here I want to check if the pointer is 'blue'*/) NSLog(@"the creature is blue")
if (/*here I want to check if the pointer is 'red'*/) NSLog(@"the creature is red")
}
和实施:
CCSprite *blue;
CCSprite *red;
[self loadCreature:blue];
[self loadCreature:red];
提前致谢:)
- 尤尔基
【问题讨论】:
标签: objective-c pointers methods call