3. iOS 11 and Swift 4 Application Development Course Free in Hindi - Labels in XCode9

About this article

In this article, we are going to learn about labels and learn how to add text in an iOS application using labels. How to format text and labels in iOS applications using XCode 9


The Safe Area

The area marked in blue is the safe area. You can take a look into the safe area by clicking on the View Controller Scene - Safe Area in ViewController.Swift file. This is the safest area to place an element. The area marked in blue is best for all iPhones/iPads. Placing anything above/below the area or outside the area can result in an application with elements not placed properly/elements not displayed. 


Formatting Text

To format text in labels, you can click the label and then select the triangle option in the utility area. This will allow you to format the text and add options like text color, font, alignment and other formats like a shadow and even highlights. Opacity and other things can be set by using alpha in the same section.



Adding Labels / Text

To add labels (Text) to your application, you can simply drag the label element to the screen from the utility area. Make sure main.storyboard is selected. You can also add other elements by dragging and dropping them from the same area. Elements like buttons and text fields have their own properties and formats. 


A blue line will guide you in placing your element in proper place i.e in the center of the screen, etc. You can later format the text or edit the text by double-clicking on the label.




 Video Tutorial



2. iOS 11 and Swift 4 Application Development Course Free in Hindi - User Interface of XCode 9