Created
May 24, 2011 13:59
-
-
Save bsodmike/988751 to your computer and use it in GitHub Desktop.
Adding a textfield programmatically to a view in IOS
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
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
CGRect frame = CGRectMake(300, 300, 200, 30); | |
UITextField *textField = [[UITextField alloc] initWithFrame:frame]; | |
textField.borderStyle = UITextBorderStyleRoundedRect; | |
textField.textColor = [UIColor blackColor]; | |
textField.font = [UIFont systemFontOfSize:17.0]; | |
textField.placeholder = @"Suchen"; | |
textField.backgroundColor = [UIColor clearColor]; | |
textField.autocorrectionType = UITextAutocorrectionTypeYes; | |
textField.keyboardType = UIKeyboardTypeDefault; | |
textField.clearButtonMode = UITextFieldViewModeWhileEditing; | |
textField.delegate = self; | |
[self.view addSubview:textField]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment