Reputation: 323
I'm making an app in which I add people to a list by using a modal VC, that currently has only three text fields.
Problem: This is what I see in the interface builder, inside my Main.storyboard file:
I'm running Xcode version 6.2 (6C131e) and the app I'm making will be for iPod touch only, so I disabled auto-size classes. I'm expecting those text fields to be at the center of the screen (same distance from text field lateral border to screen edges). Instead I get this on the simulator:
Question: How can I set an equal distance for both the sides of text fields? Any resource like tutorials, examples, guides are appreciated, because I am a very beginner in iOS programming. If this can be done with interface builder for me is better then programmatically.
Upvotes: 0
Views: 545
Reputation: 23872
If you are not using Autolayout then the default Autoresizing property should be
Change the Autoresizing property to this :
Check this question : Any other method to resize views, other than Auto-layout
Upvotes: 1
Reputation: 186
As simple as this:
In the Align menu from the bottom of interface builder if you set this constraint to 0 it will be the center of the view
Upvotes: 2
Reputation: 8782
Select First Textfield
Goto Pin-> Uncheck constraints to Margin-> Select Top,Left,right constraints with default value(or change if want ex. 16 left,right,30 top).
For Second and Third Textfield Goto Pin->Uncheck constraints to Margin->Select Top,Left,right constraints
Upvotes: 1
Reputation: 1468
I just take horizontally as example. You have two ways to make it in the centre.
1. Make leading space equals trailing space.
I recommend you can study with raywenderlich tutorial. http://www.raywenderlich.com/50317/beginning-auto-layout-tutorial-in-ios-7-part-1
Upvotes: 0