@H_301_8@
输出我看到:你可以看到我也看到了顶部,左边和右边的边框,它们是黑色的,我想要删除它们.只需底部白色厚2.0边框.@H_301_8@
我正在使用的代码(source):@H_301_8@
@H_301_8@
var border = CALayer()var wIDth = CGfloat(2.0)border.bordercolor = UIcolor.whitecolor().CGcolorborder.frame = CGRect(x: 0,y: tv_username.frame.size.height - wIDth,wIDth: tv_username.frame.size.wIDth,height: tv_username.frame.size.height)border.borderWIDth = wIDthtv_username.backgroundcolor = UIcolor.clearcolor()tv_username.layer.addSublayer(border)tv_username.layer.masksToBounds = truetv_username.textcolor = UIcolor.whitecolor()解决方法 试着这样做.
@H_301_8@
@H_301_8@
var bottomline = CALayer()bottomline.frame = CGRectMake(0.0,myTextFIEld.frame.height - 1,myTextFIEld.frame.wIDth,1.0)bottomline.backgroundcolor = UIcolor.whitecolor().CGcolormyTextFIEld.borderStyle = UITextborderStyle.NonemyTextFIEld.layer.addSublayer(bottomline)
您必须将borderStyle属性设置为None@H_301_8@
如果您正在使用自动布局,则设置完美约束,否则不会出现底线.@H_301_8@
希望能帮助到你.@H_301_8@ 总结
以上是内存溢出为你收集整理的ios – 如何在Swift中只显示UITextField的底部边框全部内容,希望文章能够帮你解决ios – 如何在Swift中只显示UITextField的底部边框所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)