8000 Underlined textfield · Issue #40 · bhlvoong/LBTATools · GitHub
[go: up one dir, main page]

Skip to content

Underlined textfield  #40

Open
Open

Description

Hi,

First of all thank you for this lib !

Just wanted to know if UITextfield could be underlined in your form controller ?
I used the function below in some projects and it was working fine but as soon as it's embedded in the FormController stack, there is not underline anymore.

extension UITextField {
	func underlined(){
		let border = CALayer()
		let lineWidth = CGFloat(1)
		border.borderColor = UIColor.black.cgColor
		border.frame = CGRect(x: 0, y: self.frame.size.height - lineWidth, width:  self.frame.size.width, height: self.frame.size.height)
		border.borderWidth = lineWidth
		self.layer.addSublayer(border)
		self.layer.masksToBounds = true
	}
}

Here is the setup, I removed some fields, buttons and stuff in the description below easier to see for you I guess:

[name, address1 ...].forEach(applyTextFieldStyle)
formContainerStackView.stack(name, nameError, ...), spacing: 8).withMargins(.init(top: 16, left: 8, bottom: 16, right: 8))

Here is the function to setup my textfields:

	private func applyTextFieldStyle(textfield: UITextField) {
		textfield.constrainHeight(40)
		textfield.delegate = self
		textfield.textColor = .black
		textfield.backgroundColor = .clear
		textfield.font = .systemFont(ofSize: 13)
		textfield.underlined()
	}

Would be really nice if someone could find my miss in there, I'm stuck on that and I'd really love to use this lib.

Regards

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0