Comment puis-je me débarrasser de ces avertissementsComment corriger cet avertissement "ne répond pas"?
"Attention: 'UIButton' ne peut pas répondre à '-setPosition:'
et
" Attention: 'UIButton' ne peut pas répondre à « - addAnimation: forKey »
Je les ai ici:
- (void)monBtnIn {
[monButton setPosition:CGPointMake(113.5,256.5)];
[monButton addAnimation:[self monInAnimation]
forKey:@"position"];
}
Tout construit et se charge bien mais je n'aime pas les avertissements. Je suppose que c'est quelque chose à voir avec le fait que c'est un UIButton et non un CALayer. Alors, comment est-ce que je peux faire cela pour un UIButton?
le fichier .h
IBOutlet UIButton *monButton;
C'est le KeyFrameAnimation - il crée une animation 'springy' qui installe.
- (CAAnimation*)monInAnimation {
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path,NULL,113,520);
CGPathAddLineToPoint(path, NULL, 113.5, 286);
CGPathAddLineToPoint(path, NULL, 113.5, 242);
CGPathAddLineToPoint(path, NULL, 113.5, 270);
CGPathAddLineToPoint(path, NULL, 113.5, 250);
CGPathAddLineToPoint(path, NULL, 113.5, 262);
CGPathAddLineToPoint(path, NULL, 113.5, 254);
CGPathAddLineToPoint(path, NULL, 113.5, 258);
CGPathAddLineToPoint(path, NULL, 113.5, 256.5);
CAKeyframeAnimation *
animation = [CAKeyframeAnimation
animationWithKeyPath:@"position"];
[animation setPath:path];
[animation setDuration:1.5];
NSArray *arr = [NSArray arrayWithObjects:[NSNumber numberWithFloat:0.0],
[NSNumber numberWithFloat:0.12],
[NSNumber numberWithFloat:0.24],
[NSNumber numberWithFloat:0.36],
[NSNumber numberWithFloat:0.48],
[NSNumber numberWithFloat:0.60],
[NSNumber numberWithFloat:0.72],
[NSNumber numberWithFloat:0.84],
[NSNumber numberWithFloat:1.0],nil];
[animation setKeyTimes:arr];
[animation setTimingFunctions:[NSArray arrayWithObjects:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn],
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut], nil]];
//[animation setAutoreverses:YES];
CFRelease(path);
return animation;
}
Merci beaucoup à l'avance pour vous aider!
Bien sûr! ... Merci! – Jonathan