简体   繁体   中英

iOS app layout in the simulator different than on the actual device

My app looks completely different on a real device compared to a simulator. I used storyboard and used "add missing constraints" on all objects to remove warnings. Could this have caused the problem?

The actual device has most image views collapsed in the upper left corner The simulator (for all devices you can test with) shows all 4 images filling the screen

Thanks!

A likely cause would be Autolayout constraints that do not create the intended effect.

You may be seeing the expected behaviour in the simulator simply because it has old cached versions of the NIB files... sometimes will get device/simulator differences due to this. Alternatively, could be the app on the device that has the old version. A clean build may result in problem resolved or seeing the same problem in both places, either of which solves half the question.

Using the automatic "Add missing constraints" is almost certainly the immediate cause here, if the problem occurred at the same time you did that.

Presuming you have the project under source control, I'd recommend rolling back and adding missing constraints in a more planned way, as the automatic system isn't smart enough for every scenario it seems.

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