IOS_UITextField basic operations
Basic operations
UITextField * userNameTextField = [[UITextField alloc] init]; userNameTextField. frame = CGRectMake (30,100,220, 50); [self. window addSubview: userNameTextField]; [userNameTextField release]; // set the style userNameTextField. borderStyle = UITextBorderStyleRoundedRect; userNameTextField. placeholder = @ "Enter your name"; userNameTextField. text = @ "OUTLAN"; userNameTextField. clearButtonMode = UITextFieldViewModeWhileEditing; // you can specify the time when UILabel * leftLable = [[UILabel alloc] initWithFrame: CGRectMake (0, 0, 20, 20)]; leftLable. text = @ "N"; // set the display time of the left and right views userNameTextField. leftView = leftLable; userNameTextField. leftViewMode = UITextFieldViewModeAlways; [leftLable release]; userNameTextField. enabled = YES; // set whether to allow the input of userNameTextField. clearsOnBeginEditing = NO; // empty userNameTextField during input. secureTextEntry = NO; // displays dots, which are generally used to enter the password userNameTextField. keyboardAppearance = UIKeyboardAppearanceDark; // The keyboard color is black userNameTextField. keyboardType = UIKeyboardTypeEmailAddress; // set the keyboard style userNameTextField. returnKeyType = UIReturnKeySearch; // set the return key style UIView * keyBoard = [[UIView alloc] initWithFrame: CGRectMake (0, 0, 0,300)]; keyBoard. backgroundColor = [UIColor greenColor]; // userNameTextField. inputView = keyBoard; // Replace the keyBoard [keyBoard release]; UIView * inputAccessView = [[UIView alloc] initWithFrame: CGRectMake (0, 0, 0, 20)]; inputAccessView. backgroundColor = [UIColor yellowColor]; userNameTextField. inputAccessoryView = inputAccessView; // secondary entry [inputAccessView release];
Revoking the keyboard setting proxy object, usually self
// Sets the proxy textFiled. delegate = self;
Current class Compliance Agreement
@interface AppDelegate : UIResponder
Implementation Protocol
-(BOOL) textFieldShouldReturn :( UITextField *) textField {NSLog (@ "Click Return"); [textField resignFirstResponder]; // discard the first responder and reclaim the keyboard return YES ;} -(BOOL) textFieldShouldBeginEditing :( UITextField *) textField {NSLog (@ "ining"); return YES;}-(BOOL) textFieldShouldEndEditing :( UITextField *) textField {NSLog (@ "ending"); return YES ;}