Detail View on Storyboard too zoomed in - creates misaligned objects in simulator

余生长醉 提交于 2019-12-12 03:26:16

问题


I have perhaps a beginner's question but have not found any solutions addressing this specific problem after searching endlessly on stackoverflow and other forums.

My detail view in the storyboard appears to be too zoomed in. At this point, zooming in and out simply zooms in and out on the storyboard, but not the detail view specifically.

Indicators of this are that the alignment arrow to the left of my button is not positioned at half-latitude of the Detail View box, although when I align my button to this marker I do see a crosshair indicating that my button is "centered".

Detail View - Further Out

Upon simulation, it is apparent that using these crosshairs produces a run-time alignment far right and up from being centered. Where my button is currently placed seems to be in the center of the simulator screen but would like my guidelines to allow the button to be centered using the guidelines suggested.

Simulator View

A) How do I "zoom out" within the Detail View so I can see the entire screen in the detail view?

B) How can I center my object if the guidelines are inherently off-center?

Thank you so much for you advice and input.


回答1:


Are you using constraints to keep the various controls in place etc...?

If not try:

  1. Select all elements in the UI of the detail view. Click on an empty spot somewhere in the View and press CMD + A.
  2. Click on resolve auto layout issues at the bottom right of the Nib editor. (it's the right most icon)
  3. Click on Clear Constraints
  4. Click on resolve auto layout issues again, then Reset to Suggested Constraints

From here, tweak your constraints as per the UI you're working with i.e. iPhone, iPad and whatever orientation it's in etc...




回答2:


I forgot to mention how I fixed the "too zoomed-in" problem.

In the storyboard controller, on the left navigator panel, within the file inspector, I simply unchecked "Use Size Classes" within the Interface Builder Document section. My view controller changed into a normal iPhone shape and everything finally fit into place.



来源:https://stackoverflow.com/questions/35305204/detail-view-on-storyboard-too-zoomed-in-creates-misaligned-objects-in-simulato

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!