hi, i tried to implement this code that move UIImageView's objects,
i get a compiler warning for the objects (jumpBall1...) in the createPosition method: UIImageView may not respont to -setupperLimit, -setlowerLimit, -setspeed
code:
@interface JumpBallClass : UIViewController
{
CGPoint center;
CGPoint speed;
CGPoint lowerLimit;
CGPoint upperLimit;
IBOutlet UIImageView *jumpBall1;
IBOutlet UIImageView *jumpBall2;
}
@property (assign) CGPoint lowerLimit;
@property (assign) CGPoint upperLimit;
@property (assign) CGPoint speed;
@property(nonatomic,retain) IBOutlet UIImageView *jumpBall1;
@property(nonatomic,retain) IBOutlet UIImageView *jumpBall2;
- (void)update;
@end
@implementation JumpBallClass
- (void)update
{
center.x += speed.x;
center.y += speed.y;
if (center.x > upperLimit.x || center.x < lowerLimit.x)
{ speed.x = -speed.x; }
if (center.y > upperLimit.y || center.y < lowerLimit.y)
{ speed.y = -speed.y; }
}
@end
- (void) jumpOnTimer {
NSArray * balls = [NSArray arrayWithObjects:jumpBall1, jumpBall2, nil];
[balls makeObjectsPerformSelector:@selector(update)];
}
- (void) createPosition {
[jumpBall1 setUpperLimit:CGPointMake(60, 211)];
[jumpBall1 setLowerLimit:CGPointMake(0, 82)];
[jumpBall1 setspeed:CGPointMake(2.0,7.0)];
...
}