使用Cocos2d-iphone和objective-c游戏开发框架。带int参数的选择器函数?
我创建一个按钮:
CCMenuItemImage *slot = [CCMenuItemImage itemFromNormalImage:@"BattleMoveSelectionSlot1.png"
selectedImage:@"BattleMoveSelectionSlot2.png"
target:self selector:@selector(moveChosen:i)];
而且我moveChosen
方法是:
-(void)moveChosen:(int)index {
}
但是,由于某种原因,我得到@selector(moveChosen:i)
错误,其中i为整数。那么,如何在按下按钮时将一个整型参数传递给我的函数呢?
的错误是
预期 ':'
看到这个答案 http://stackoverflow.com/questions/7899223/how-can-i-pass- an-int-value-through-a-selector-method – umairhhhs
http://stackoverflow.com/questions/7899223/how-can-i-pass-an-int-value-through-a-selector-method * *看到这个线程** – umairhhhs