UITextField Only Top And Bottom Border

后端 未结 11 1005
温柔的废话
温柔的废话 2020-12-07 22:46

I currently have a regular border. I would like to only have a top and bottom border.

How do I accomplish this?

Using the UITextField<

11条回答
  •  醉话见心
    2020-12-07 23:27

    @user3075378's great & simple example in Swift

    var bottomBorder = CALayer()
    bottomBorder.frame = CGRectMake(0.0, textField.frame.size.height - 1, textField.frame.size.width, 1.0);
    bottomBorder.backgroundColor = UIColor.blackColor().CGColor
    textField.layer.addSublayer(bottomBorder)
    

提交回复
热议问题