🧰UIKit Handbook
Original Author: Richie Sun
UIView
An object that manages the content for a rectangular area on the screen. The UIView
class defines the behaviors that are common to all views. All following UI elements are a subclass of UIView
All UIViews share the following attributes:
Attribute | Type | Description |
---|---|---|
| CGFloat | The alpha value of the view. |
| UIColor | The background color of the view. |
| CGRect | The view’s bounded rectangle that describes the view's location and size relative to its own coordinate system (Independent of any other views). |
| Bool | A boolean value that determines if the view’s subviews are constrained by the bounds of the view. |
| CGRect | The view’s frame rectangle that describes the view's location and size relative to its superview’s coordinate system. |
| Bool | A boolean value that determines if the view is hidden. |
| CGFloat | The radius utilized to round the corners of any view. Setting the corner radius equal to half the width/ height will make the view an ellipse. |
| CGColor | The color of the view’s border. Note that you are not able to directly specify UIColors like |
| CGFloat | The width of the view’s border (in pixels). |
| Float | Specifies the opacity of the view. Value is a floating point number 0..1 inclusive, where 1 indicates an opaque view, and 0 indicates a completely transparent view (basically Hidden). |
Text-Based Views
The following views are utilized for displaying text in your views. Whether that be for titles, headers, descriptions, or input text boxes.
All of the views in this section shared the following attributes:
Attribute | Type | Description |
---|---|---|
| UIFont | The font of the text (More setup needed for UITextView). |
| String? | The text that the label displays. |
| NSTextAlignment | The technique for aligning the text ( |
| UIColor | The color of the text. |
UILabel
A view that displays one or more lines of informational text. Most commonly used to display titles, headers, or short lines of text that are NOT scrollable.
Unique attributes:
Attribute | Type | Description |
---|---|---|
| Int | The maximum number of lines for your text. Setting this to 0 will allow any number of lines depending on the constraints |
UITextField
An object that displays an editable text area in your interface. Most commonly used to obtain shorter text input from users, as the textField area is NOT scrollable nor multiline
Unique attributes:
Attribute | Type | Description |
---|---|---|
| BorderStyle | Specifies the basic border style of the textField. |
| UITextFieldDelegate? | The delegate used to keep track of and manage user interaction with the textField |
| UIKeyboardType | Specifies the type of keyboard that the textField pulls up when interacted with. |
| String? | The text string that displays when there is no other text in textField. Often used to indicate what information the user should input |
UITextView
A scrollable, multiline text region.
Unique attributes:
Attribute | Type | Description |
---|---|---|
| UITextViewDelegate? | The delegate used to keep track of and manage user interaction with the textView |
| UIKeyboardType | Specifies the type of keyboard that the textView pulls up when interacted with. |
| Bool | A Boolean value that indicates whether the textView can be edited |
| Bool | A Boolean value that indicates whether the textView is scrollable |
| Bool | A Boolean value that indicates whether the textView is selectable. NOTE: This must be set to true if you want to change the font! |
More Views Coming Soon!
Last updated