Create TextField (UITextField) in runtime

by alex 17. February 2009 05:23

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];


 

Currently rated 4.3 by 3 people

  • Currently 4.333333/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

General

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen