Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

underline uitextfield swift rotate

class UnderlinedTextField: UITextField {
    private let defaultUnderlineColor = UIColor.black
    private let bottomLine = UIView()

    override func awakeFromNib() {
        super.awakeFromNib()

        borderStyle = .none
        bottomLine.translatesAutoresizingMaskIntoConstraints = false
        bottomLine.backgroundColor = defaultUnderlineColor

        self.addSubview(bottomLine)
        bottomLine.topAnchor.constraint(equalTo: self.bottomAnchor, constant: 1).isActive = true
        bottomLine.leadingAnchor.constraint(equalTo: self.leadingAnchor).isActive = true
        bottomLine.trailingAnchor.constraint(equalTo: self.trailingAnchor).isActive = true
        bottomLine.heightAnchor.constraint(equalToConstant: 1).isActive = true
    }

    public func setUnderlineColor(color: UIColor = .red) {
        bottomLine.backgroundColor = color
    }

    public func setDefaultUnderlineColor() {
        bottomLine.backgroundColor = defaultUnderlineColor
    }
}
Comment

PREVIOUS NEXT
Code Example
Swift :: ionic Library not found for -lGoogleToolboxForMac 
Swift :: loop key value swift 
Swift :: round up swift 
Swift :: navigationController.pushViewController 
Swift :: return multiple values from a function swift 
Swift :: Save class in userdefaults ios swift 
Swift :: how to check object is nil in swift 
Swift :: generate random bool swift 
Swift :: swift create array from range 
Swift :: swift thread.sleep 
Swift :: swift dispatch queue 
Swift :: how to change background color of ui button swift 
Swift :: navigation title bar color swftui 
Swift :: ios swift create new background thread 
Swift :: swift push view controller programmatically 
Swift :: swift guard let 
Swift :: set right bar button item swift 
Swift :: swift5 get uiview height 
Swift :: average in array swift 
Swift :: socket io swift 
Swift :: accessing tab bar item action swift 
Swift :: swift create an empty dictionary 
Swift :: swift function declaration 
Swift :: two variable sum 
Swift :: table view content size not return correctly 
Swift :: Log httpurlresponse swift 
Swift :: int in swift 
Swift :: list header swiftui 
Swift :: Computed Property In Extension Swift 
Swift :: Swift Find Number of Set Elements 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =