简体   繁体   中英

iOS - Whitespace appearing in iPhone 6 and 6+

While testing my app, some whitespace appears only in iPhone 6 and 6+.

Some info about the setting

My app storyboards are designed for iPhone 4s, I've added launch images in @3x (1242*2208) and @2x (750*1334) in images.xcassets and added an image named Default-568h@2x.png (this one was first 720*1280 and currently 1080*1920 for a reason I'm currently asking myself) in app files.

Edit : I have auto layout, use size classes options is disabled.

I don't have any problems with iPhone4s or iPhone5. I've already fixed the black bars at top and bottom of the app-thingy.

Problem definition

But when it comes to the iPhone6 and 6+, poof . App opens but has a white frame in bottom and right corner.

I'm adding some screenshots to show the problem thoroughly.

These two belong to iPhone 5.

iPhone5-1

Background is fading here, view is totally normal.

iPhone5-2

And now, for something completely different:
iPhone6-1

See those lines? Navigation bar and tableview stops there, but tab bar is functioning right.

iPhone6-2

In here, the switch is slided a bit. But the total view is not bad.

So, what did I miss?

I had similar issues.

  • First I had problems like your first image . The solution to that was to add proper LaunchImages (.png files) , their proper sizes are shown in warnings if they are wrong.
  • Secondly I had the issue in the image where you painted a red line . The solution to this problem was to open the storyboard, click on the view controller (main/initial View controller in my case) and show the Attributes inspector, and finally select Size (iPhone 4.7 inch in my case) in Simulated metrics (I had to adjust my layout) .

I hope this helps.

Much thanks to @JCChaparro for providing the starting line for me.

I'm adding an detailed answer for help others in the same situation.

There is what I did;

Added height and width constraints to wallpaper, only width constraints to custom-made navigation bars.

This will only result in fixed navigation bars, not totally screen-size adjusted texts or images.

You're going to have adjust them by yourselves, using constraints. Use reset recommended constraints to your advantage, I fixed some pages using only this option.

But still, it has flaws. So, when you see some flaw caused by recommended constraints ; try to use only width constraints. That did the trick for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM