-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUITextField
More file actions
32 lines (27 loc) · 1.19 KB
/
UITextField
File metadata and controls
32 lines (27 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import UIKit
extension UITextField {
func setLeftPaddingPoints(_ amount: CGFloat){
let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: amount, height: self.frame.size.height))
self.leftView = paddingView
self.leftViewMode = .always
}
func setRightPaddingPoints(_ amount: CGFloat) {
let paddingView = UIView(frame: CGRect(x: 0, y: 0, width: amount, height: self.frame.size.height))
self.rightView = paddingView
self.rightViewMode = .always
}
func addBottomBorder() {
let bottomLine = CALayer()
bottomLine.frame = CGRect(x: 0, y: self.frame.size.height - 1, width: UIScreen.main.bounds.size.width - 80, height: 1)
bottomLine.backgroundColor = ThemeManager.shared.color(color: .bottomLineColor)?.cgColor
borderStyle = .none
layer.addSublayer(bottomLine)
}
func configureRoundedTextField() {
self.layer.cornerRadius = 20.0
self.layer.masksToBounds = true
self.backgroundColor = ThemeManager.shared.color(color: .textFieldBackground)
self.layer.borderWidth = 1.0
self.layer.borderColor = UIColor.black.withAlphaComponent(0.05).cgColor
}
}