How do I call a method with multiple parameters
hi I'm new to iOS development and i have a simple question.
I don't know how to call the following method.
-(void) ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
//do something here开发者_JS百科
}
But when I use
[self ccTouchesBegan]
I get an error and it doesn't work. I know this is really simple question but I can't figure it out by myself
Thank you.
those are delegate methods.u should not call it manually.
more over u didn't give correct arg objects to it.
u have been using cocos2d
read it and make clear
http://www.cocos2d-iphone.org/wiki/doku.php/tips:touchdelegates
You don't call -ccTouchesBegan:withEvent: -- cocos2d calls it for you. What you have to do is define your own version of it to process the beginning of a touch. Read a little more introductory examples and you'll see how it's used. For instance, How To Make A Simple iPhone Game with Cocos2D uses touchesEnded, but it's the same principle.
You are missing the rest of the method. You should do something like this:
[self ccTouchesBegan:yourTouch withEvent:yourEvent];
Being yourTouch of the type (NSSet*)
and yourEvent of the type (UIEvent*
).
精彩评论