4

I am using Auto Layout and Size Classes in my storyboard and have a button that has a vertical constraint to the bottom of my view controller. However, when I run my app on my iPhone6 Plus in zoomed mode (Settings -> Display & Brightness -> Display Zoom -> Zoomed) the button doesn't reposition itself.

Is this a bug? If so, what would be the best workaround, I could find out if the app is in zoomed mode and change the constraint accordingly?

Or am I doing something else wrong here?

m.y
  • 691
  • 9
  • 21
  • Is there some code relative to the view controller? Can you take a screenshot? – jalone Jan 04 '16 at 16:18
  • thanks @jalone i found out what the problem was. it did lead to another question though http://stackoverflow.com/questions/34618527/uiimageview-height-on-iphone-6-and-iphone-6-plus-zoomed-display-mode if you have any insights there by any chance – m.y Jan 05 '16 at 18:15

2 Answers2

7

Basically, an iPhone 6+ in zoom mode is an iPhone 6. And an iPhone 6 in zoom mode is an iPhone 5. You shouldn't have to change anything, just make sure that your code works on iPhone 5 and 6.

And don't try finding out which phone you are running on. For example, there are ways by using some device info to find that you are running on a certain iPhone model - if you use these methods then your code might think it's running on an iPhone 6+ when it is zoomed and get everything wrong. Just check the size of the screen (and make sure that you check for rotation as well).

gnasher729
  • 51,477
  • 5
  • 75
  • 98
  • thanks @gnasher729 the issue was happening only in the zoomed view, see my answer. Although it did lead to another question which I have asked here http://stackoverflow.com/questions/34618527/uiimageview-height-on-iphone-6-and-iphone-6-plus-zoomed-display-mode if you also had any insights by any chance. – m.y Jan 05 '16 at 18:17
  • For others with my problem, if you use [`SDVersion`](https://github.com/sebyddd/SDVersion), make sure you call `resolutionSize` instead of `deviceSize` is you do some manual computations of directly target `iPhone 5`. – Iulian Onofrei Nov 28 '17 at 09:57
1

The solution I found was to add constraints to my container view. There was code that was setting the container view frame programatically based on a background image.

No matter if in zoomed or standard display mode, the actual background image's size doesn't change even though it will all fit on the screen as it gets scaled. So my container frame ended up bigger than expected and hence why my button was almost out of the device's screen.

m.y
  • 691
  • 9
  • 21