0

I have an UIImageView located at the bottom right side of the screen that moves a few points to the left each time the user presses a button. When the image reaches the other side of the screen I used an if statement to place it back at the right side. I have auto layout off and Autosizing with these options: enter image description here

So it can work for both, 3.4 inch display and 4 inch display.

The first time around the image moves from right to left the way its supposed to in both screens. But when it reaches the end and reappears back at the beginning it only works for 4 inch display. In the 3.5 inch display the image is off the screen because for some reason is not recognizing the Autosizing options anymore.

My question is: Is there a way to set an if statement that says something like this?

if (3.5 inch display) {
ImageOne.center = CGPointMake(400,300);
} else {
  ImageOne.center = CGPointMake(300,400);
}

I imagine this way could be the solution to show the image properly in both screens, if not how can i fix it?

Any help would be greatly appreciated since I been trying to fix this all day.

Thank you in advance!

2 Answers2

1

Try this

if ([[UIScreen mainScreen] bounds].size.height == 568)){
    //4 inch
    ImageOne.center = CGPointMake(300,400);

}
else{

    ImageOne.center = CGPointMake(400,300);

}
  • Still no working. Unbelievable, i been trying and trying and trying and i can't find the solution. Here is a link to a more detailed question of this problem: http://stackoverflow.com/questions/25520653/ios-autosizing-not-working-on-uiimageview – Luis Villavicencio Aug 27 '14 at 11:45
0

This will be work only on one condition that is uncheck "Use Auto Layout".

for that Go to the File inspector in interface builder, and untick "Use Auto LayoutUncheck Auto layout

i hope this will work for you..

Dipen Desai
  • 237
  • 1
  • 16