UITextField的基本使用
//初始化
UITextField *feilds = [[UITextField alloc]initWithFrame:CGRectMake(130, 200, 200, 35)];
//占位字符串(在没有任何输入时,给出的提示字符串);
feilds.placeholder = @"请输入密码";
//要显示的文本内容
feilds.text = @" ";
//文本内容的颜色
feilds.textColor = [UIColor blueColor];
//设置文本字体(黑体加粗)
feilds.font = [UIFont fontWithName:@"Helvetica-Bold" size:20];
//文本的对齐方式(水平方向)
feilds.textAlignment = NSTextAlignmentLeft;
//输入控制
是否允许输入
feilds.enabled = NO;//不允许输入,不弹出键盘
feilds.enabled = YES;//默认是YES,允许输入
//开始输入时是否清空输入框内容
feilds.clearsOnBeginEditing = YES;//清空
feilds.clearsOnBeginEditing = NO;//不清空
//文字shifou以原点格式显示
feilds.secureTextEntry = YES;//密码模式
feilds.secureTextEntry = NO;//普通密码
//弹出键盘的类型(枚举值)
feilds.keyboardType = UIKeyboardTypeNumbersAndPunctuation;
//键盘右下角return按钮类型(枚举值)
feilds.returnKeyType = UIReturnKeyNext;
//外观控制
//边框样式(枚举型)
feilds.borderStyle = UITextBorderStyleRoundedRect;
//清除按钮模式(枚举型)
feilds.clearButtonMode = UITextFieldViewModeAlways;