简体   繁体   中英

ios what is UITextField Border color value

I have a UIView and I want to set the border color to the UIView.

I have a UITextField and below that I have a UIView. In that View I have some check boxes.

Now I want to give same look and feel as UITextField For that I want following thing

  • I need to make the UIView round corder as UITextField (I have done that)
  • I need to apply same border color value to UIView as UITextField is having

I am stuck in point number two. I am getting border color of UITextField as below

myTextField.layer.borderColor

but with that I am getting more black color border, but on UITextField it looks very nice and low color value.

Please help me in finding a real value.

//for normal
textView.layer.borderWidth = 2.0

textView.layer.borderColor = UIColor.blue.cgColor

//for RgbColour 

textView.layer.borderWidth = 2.0

textView.layer.borderColor = UIColor(rgb: 0xC12326, alphaVal: 1).cgColor

extension UIColor{
    convenience init(rgb: UInt, alphaVal: CGFloat) {
        self.init(
            red: CGFloat((rgb & 0xFF0000) >> 16) / 255.0,
            green: CGFloat((rgb & 0x00FF00) >> 8) / 255.0,
            blue: CGFloat(rgb & 0x0000FF) / 255.0,
            alpha: alphaVal
        )
    }
}

Note: - customize your color and give the same border it should look like same.

默认控件边框颜色为#c2c2c2。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM