杂谈
定义一个 TextField
userNameField=[[UITextField
alloc]initWithFrame:CGRectMake(userNameImg.frame.origin.x+30,userNa
meImg.frame.origin.y,165,40)];
userNameField.placeholder=@"UserName";
userNameField.backgroundColor=[UIColor clearColor];
userNameField.delegate=self;
userNameField.contentHorizontalAlignment=UIControlContentHorizonta
lAlignmentCenter;
userNameField.contentVerticalAlignment=UIControlContentVerticalAlign
mentCenter;
userNameField.borderStyle=UITextBorderStyleNone;
userNameField.font=[UIFont systemFontOfSize:14.0];
[self.view addSubview:userNameField];
//设置边框样式,只有设置了才会显示边框样式
text.borderStyle = UITextBorderStyleRoundedRect;
typedef enum {
UITextBorderStyleNone,
UITextBorderStyleLine,
UITextBorderStyleBezel,
UITextBorderStyleRoundedRect
} UITextBorderStyle;
//设置输入框的背景颜色,此时设置为白色如果使用了自定义的背景图片边框会被忽略掉
text.backgroundColor = [UIColor whiteColor];
//设置背景
text.background = [UIImage imageNamed:@"dd.png"];
//设置背景
text.disabledBackground = [UIImage imageNamed:@"cc.png"];
//当输入框没有内容时,水印提示提示内容为 password
评论0
最新资源