"Create TextField (UITextField) in runtime"

Mon 11 May 2009

UITextField *loginTextField = [[UITextField alloc] initWithFrame:CGRectMake(20, 104, 285, 23)];

 

loginTextField.borderStyle = UITextBorderStyleBezel;

loginTextField.textColor = [UIColor blackColor];

loginTextField.font = [UIFont systemFontOfSize:14.0];

loginTextField.placeholder = @"<enter email>";

loginTextField.backgroundColor = [UIColor whiteColor];

loginTextField.autocorrectionType = UITextAutocorrectionTypeNo; // no auto correction support

 

loginTextField.keyboardType = UIKeyboardTypeEmailAddress; // use the default type input method (entire keyboard)

loginTextField.returnKeyType = UIReturnKeyDone;

loginTextField.delegate = self;

loginTextField.clearButtonMode = UITextFieldViewModeWhileEditing; // has a clear 'x' button to the right

 

 

[self.view addSubview:loginTextField];