textField控件的使用

   CGRect rect = CGRectMake(60, 80, 280, 60);

    UITextField *textField= [[UITextField alloc] initWithFrame:rect];

    textField.borderStyle = UITextBorderStyleRoundedRect;

    textField.placeholder = @"input your word";

    textField.autocorrectionType = UITextAutocorrectionTypeNo;

    textField.returnKeyType = UIReturnKeyDone;

    textField.clearButtonMode = UITextFieldViewModeWhileEditing;

    textField.keyboardType = UIKeyboardTypeEmailAddress;

    textField.keyboardAppearance = UIKeyboardAppearanceDark;

    textField.delegate = self;

    [self.view addSubview:textField];

    

}

-(BOOL)textFieldShouldClear:(UITextField *)textField

{

    NSLog(@"textField.content = %@",[textField text]);

    [textField resignFirstResponder];

    return YES;

}