Since we have just started to learn iOS, there are a lot of problems that you will encounter, and it may be a problem for everyone. I will also be in their own learning process encountered problems and solutions written to share with you. This blog to solve the problem is the iOS simulator display and Main.storyboard in the layout of inconsistent or wrong.
(1) Create a new iOS application project and select Single View application on the right. Click Next, the project name is any, the following devices select iphone and then create the success.
(2) Then in the Main.storyboard of the interface design, we drag several space to the horizontal center position. :
。
(3) Then click Run, Simulator select iphone5s, run Result:
。
(4) Analysis of the results, found that the original design in the central control all ran to the right or even escaped the border. Completely inconsistent with the expectations. We need to find a way out.
(5) This is the most common problem for us novices. This is caused by our use of automatic layout. The solution is to find "use Auto Layout" and "Use Size Classes" on the right, and cancel both options. Cancellation may be prompted, the next step is possible.
。
(6) We can then find that our main.storyboard has changed and become the iphone interface, which is displayed in the same interface as the one we just showed in the simulator. Finding this problem is not a problem with the simulator, it's just the layout that we did when we designed it.
。
(7) Re-drag the space in the Main.storyboard to the horizontal center position, and then display the following in the simulator. The discovery control already appears where we expect it to be. The simulator is displayed correctly and the problem is resolved successfully.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Get started with iOS FAQs--ios Simulator display dislocation problem solving