Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @implementation ThirdView
- @synthesize ball;
- @synthesize ball2;
- -(void) onTimer {
- ball.center = CGPointMake(ball.center.x+pos.x,ball.center.y+pos.y);
- if (ball.center.x > 320 || ball.center.x < 0)
- pos.x = -pos.x;
- if (ball.center.y > 460 || ball.center.y < 0)
- pos.y = -pos.y;
- }
- -(void) onTimer2 {
- ball2.center = CGPointMake(ball2.center.x+pos2.x,ball2.center.y+pos2.y);
- if (ball2.center.x > 320 || ball2.center.x < 0)
- pos2.x = -pos2.x;
- if (ball2.center.y > 460 || ball2.center.y < 0)
- pos2.y = -pos2.y;
- }
- // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- - (void)viewDidLoad {
- [super viewDidLoad];
- pos = CGPointMake(14.0,7.0);
- [NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector (onTimer) userInfo:nil repeats:YES];
- pos2 = CGPointMake(14.0,7.0);
- [NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector (onTimer2) userInfo:nil repeats:YES];
- }
- - (IBAction)buttonClick {
- [self.parentViewController dismissModalViewControllerAnimated:YES];
- }
- @end
Add Comment
Please, Sign In to add comment