I want to display a button(blue square in below images) at fixed distance from bottom of screen.
Below are contraints :
When running app on different simulators, button is displayed at different positions. Look below images to see the difference.
iOS 6.1 and 4 inch simulator :
iOS 7 and 4 inch simulator :
iOS 6.1 and 3.5 inch simulator :
On iOS 7 and 3.5 inch simulator, this button is not visible.i.e its origin.y
is greater than screen height.
Any idea why this happens?
EDIT : Edited constraints (still not working)
UPDATE : I could narrow down the scope of issue. In storyboard, I have this button and other subviews in main view. Programmatically I add mapView to this main view and add all main view's subviews to mapView as shown below.
// Add mapView to main view
mapView = ...;
[self.view addSubview:self.mapView];
// Remove subviews from main view
[self.button removeFromSuperview];
...
// Add subviews into mapView so that they are visible on map
[self.mapView addSubview:self.button];
...
Now, If I comment above code and run the app then button is displayed at correct position, but with above code uncommented I run into the issue of button misplacement.
UPDATE : Partial answer to this issue is to add constraints programmatically. I said partial, because I have other views, along with this button, which are displayed properly. I don't have their constraints in code. Thus, there is still something to explore.