问题
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:
- Select all elements in the UI of the detail view. Click on an empty spot somewhere in the View and press
CMD + A
. - Click on
resolve auto layout issues
at the bottom right of the Nib editor. (it's the right most icon) - Click on
Clear Constraints
- Click on
resolve auto layout issues
again, thenReset 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