I am creating a game in objective C, and I am stopped by a matter : I have a warning for passing multiple variables on @selector. What I want to do, is call a method in my UIViewController but after a delay. So I try to make a first method, that call the other after delay like this :
-(void)AnimationCoinInitWith_x:(int)x y:(int)y w:(int)w h:(int)h afterDelay:(NSTimeInterval)t
{
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:
[self methodSignatureForSelector:@selector(AnimationCoinCopyInitWith_x:y:w:h:)]];
[invocation setTarget:self];
[invocation setSelector:@selector(AnimationCoinCopyInitWith_x:y:w:h:)];
[invocation setArgument:x atIndex:1];
[invocation setArgument:y atIndex:2];
[invocation setArgument:w atIndex:3];
[invocation setArgument:h atIndex:4];
[NSTimer scheduledTimerWithTimeInterval:t invocation:invocation repeats:NO];
}
-(void)AnimationCoinCopyInitWith_x:(int)x y:(int)y w:(int)w h:(int)h
{
UIImageView* imageViewCoin = [[UIImageView alloc] initWithFrame:CGRectMake(x, y, w, h)];
[imageViewCoin setAnimationImages:images];
[imageViewCoin setAnimationRepeatCount:1000];
[imageViewCoin setAnimationDuration:(1/24)];
[imageViewCoin startAnimating];
[self addSubview:imageViewCoin];
[imageViewCoin release];
}
But it's not working, I don't know why.
Thanks for your help !