I am making a very simple app to learn Objective-C and Xcode. The app has an UIButton and a UIImageView. When the user taps the button the image moves down in a diagonal motion from right to left and when it reaches a certain point in the screen it regenerates back to do the same all over again as shown in the image below:
(Using an 'if statement')
When I open the iOS simulator using iPhone Retina (4-inch) it works perfectly fine. The problem is when I open the simulator using iPhone Retina (3.5 inch):
It loads the image and everything seems fine, I press the button until the image reaches point B but when it regenerates back this is what happens:
The image moved down.I have no clue why it does this. I been searching for an answer all day long but nothing seems to work. I have the Auto Layout box unchecked and autosizing like this:
Here is the code:
File.h
{
IBOutlet UIImageView *imageOne;
}
-(IBAction)Button:(id)sender;
@end
File.m
-(IBAction)Button:(id)sender{
//ImageOne moving down and reappearing
[UIView animateWithDuration:0.1f
animations:^{
imageOne.center = CGPointMake(imageOne.center.x -44, imageOne.center.y +41);
}];
if (imageOne.center.x < -28) {
imageOne.center = CGPointMake(368,487);
}
}
Any help would be greatly appreciated
Thank you in advance!!!