Thursday, 5 September 2013

iOS - If passed the bottom of the screen

iOS - If passed the bottom of the screen

I created a simple app that fall down an image, that's great but my
problem is when it fall down it's not repeating after searching I found a
to repeat it, but I want to know how to check if the image is at the
bottom of the screen repeat falling. here is my code
in .h file
@interface ViewController : UIViewController {
NSTimer *moveit;
IBOutlet UIImageView *img;
}
in .m file
-(void)viewDidLoad{
moveit = [NSTimer scheduledTimerWithTimeInterval:0.005 target:self
selector:@selector(fallThei) userInfo:nil repeats:YES];
}
-(void)fallThei{
img.center = CGPointMake(img.center.x, img.center.y +9);
}
and the repeat code is
img.center = CGPointMake(img.center.x, -img.frame.size.height +
img.frame.size.height/2);
So how to check if the image at the bottom then do something?

Thanks in advance.

No comments:

Post a Comment