Created
June 20, 2016 01:05
-
-
Save gazolla/4a44169c4af08feb5356f0f8d55ccaf8 to your computer and use it in GitHub Desktop.
Programmatically create UITextField
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let sampleTextField = UITextField(frame: CGRectMake(20, 100, 300, 40)) | |
sampleTextField.placeholder = "Enter text here" | |
sampleTextField.font = UIFont.systemFontOfSize(15) | |
sampleTextField.borderStyle = UITextBorderStyle.RoundedRect | |
sampleTextField.autocorrectionType = UITextAutocorrectionType.No | |
sampleTextField.keyboardType = UIKeyboardType.Default | |
sampleTextField.returnKeyType = UIReturnKeyType.Done | |
sampleTextField.clearButtonMode = UITextFieldViewMode.WhileEditing; | |
sampleTextField.contentVerticalAlignment = UIControlContentVerticalAlignment.Center | |
sampleTextField.delegate = self | |
self.view.addSubview(sampleTextField) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment