输入框一般有无边框(空白输入框),全边框(矩形输入框),加边框很简单,只需要设置UITextField的layer.borderColor属性和layer.borderWidth属性就可以了,如果要实现只带底部框线的输入框就不太好弄了,百度了一下找到了一个最笨也是挺不错的一个方法,那就是在下面直接给它加一条线就可以了。示例代码:
UITextField *passwordTextField = [[UITextField alloc] initWithFrame:CGRectMake(60, 120, 140, 23)];
passwordTextField.font = FONT(15);
passwordTextField.placeholder = @"请输入密码";
[passwordTextField setSecureTextEntry:YES];
[self.view addSubview:passwordTextField];
UIView *lineView = [[UIView alloc]initWithFrame:CGRectMake(0,passwordTextField.height - 1, passwordTextField.width, 1)];
lineView.backgroundColor = [UIColor orangeColor];
[passwordTextField addSubview:lineView];
顺便附上效果图:
deepin20怎么新增字体? deepin20安装字体的教程
Linux如何给文件权限? linux给文件添加可执行权限的技巧
deepin20桌面图标样式怎么修改? deepin更换图标主题的技巧
virtualbox打不开虚拟机怎么办? linux无法访问virtualbox的解决办法
deepin怎么注销系统? deepin系统注销与切换用户的方法
Manjaro linux怎么调鼠标速度? Manjaro鼠标设置光标速度的技巧