UITextField * tf = [[UITextField alloc] initWithFrame:CGRectMake(60, 60, 200, 50)];
//输入框样式
// tf.borderStyle = UITextBorderStyleNone;//无边框
// tf.borderStyle =UITextBorderStyleLine;//UIText边框样式行
// tf.borderStyle = UITextBorderStyleBezel;//UIText边框样式边框
tf.borderStyle = UITextBorderStyleRoundedRect;//UIText边框样式的圆角矩形
//
//tf.text = @"sdf";
// tf.textColor = [UIColor redColor];
tf.textAlignment = NSTextAlignmentCenter;
tf.font = [UIFont systemFontOfSize:20];
//提示占位符
tf.placeholder = @"请输入内容!";
// tf.enabled = NO;
tf.clearsOnBeginEditing = YES;//清除在开始编辑
tf.secureTextEntry = YES;//安全的文本输入
tf.keyboardType = UIKeyboardTypeASCIICapable;
ty.clearButtonMode = UITextFieldViewModeAlways;//编辑时随时清空
tf.returnKeyType = UIReturnKeySearch;
[self.window addSubview:tf];
[tf release];
NSLog(@"输出输入框中显示的文本 %@",tf.text);
UITextField
最新推荐文章于 2017-08-24 09:31:58 发布