5. iOS 11 and Swift 4 Application Development Course Free in Hindi - Text-Fields in XCode 9

About this article

In this article, we are going to talk about text fields, we will learn how to take input from users and how to work around with the text-fields in XCode 9


Adding Text Fields

Adding text field is similar to adding up buttons or labels, you can simply drag text field element from the utility area below in the right-hand side bottom corner. 


Again the blue lines will help you in dragging and dropping the text fields in the right direction.


A text field has certain properties which can be changed in the utility area on the right side by selecting the text-field first. 



Settings like aligning the text in the center with the alignment options and other settings like placeholders can be used. Placeholder holds the text just till the user inputs something and the text in placeholder is just for reference for the user and to tell the user what to enter in the field.





content type and text can be changed in the utility area and you can change the border of the text-field by selecting the respective border.


Content type specifies the type of content that is to be entered which can include email IDs, passwords, and even numbers. This will tell the system to open the respective keyboard type for eg. a number pad or Num Keyboard is required for entering numbers in credit card field.



The type of keyboard will appear once the content type is specified. To hide the text in password fields, the secure option should be enabled.



Video tutorial