- iOS Tutorial
- iOS - Home
- iOS - Getting Started
- iOS - Environment Setup
- iOS - Objective-C Basics
- iOS - First iPhone Application
- iOS - Actions and Outlets
- iOS - Delegates
- iOS - UI Elements
- iOS - Accelerometer
- iOS - Universal Applications
- iOS - Camera Management
- iOS - Location Handling
- iOS - SQLite Database
- iOS - Sending Email
- iOS - Audio & Video
- iOS - File Handling
- iOS - Accessing Maps
- iOS - In-App Purchase
- iOS - iAd Integration
- iOS - GameKit
- iOS - Storyboards
- iOS - Auto Layouts
- iOS - Twitter & Facebook
- iOS - Memory Management
- iOS - Application Debugging
- iOS Useful Resources
- iOS - Quick Guide
- iOS - Useful Resources
- iOS - Discussion
Aligning two buttons vertically in iOS
Auto Layout is one the most important element when it comes to designing an iOS Application. UI development has become a lot more versatile and easier using Auto Layout.
For Aligning two buttons vertically we will be using Auto Layout.
So let’s get started!
Step 1: Open Xcode → New Projecr → Single View Application → Let’s name it “AlignButtons”
Step 2: Open Main.storyboard and add two buttons, name them button 1 and button 2.
Step 3: Select both the buttons and align them vertically using the Add New Alignment Constraint menu.
Step 4: Select both the buttons tap on Add new constraints and set it to equal widths.
Step 5: Now Select left button tap on Add new constraints again and set leading and trailing spaces to 20 points.
Step 6: Now Select Right button tap on Add new constraints again and set leading and trailing spaces to 20 points.
And that’s all as soon as you’ll click on Add 2 Constraints you’ll see you buttons aligned vertically.
- Related Articles
- Make a set of buttons appear vertically with Bootstrap
- Aligning elements using the position property in CSS
- How to compare two NSDates in iPhone/iOS?
- Aligning table to X-axis using matplotlib Python
- How to get the differences between two dates in iOS?
- How can I put two buttons next to each other in Tkinter?
- Add buttons in Bootstrap Navbar
- How to get the distance between two geographic locations in iOS using Swift?
- Difference Between iOS 4.2.1 and iOS 4.3.2
- How to join two images horizontally and vertically using OpenCV Python?
- Python - Working with buttons in Kivy
- Removing minimize/maximize buttons in Tkinter
- Disable Orientation Change in iOS
- What is plist in iOS?
- How to create shadow in Android Buttons?