33 lines
772 B
Swift
33 lines
772 B
Swift
//
|
|
// TextField.swift
|
|
// VDSSample
|
|
//
|
|
// Created by Matt Bruce on 8/24/22.
|
|
//
|
|
|
|
import Foundation
|
|
import UIKit
|
|
|
|
class TextField: UITextField {
|
|
var textPadding = UIEdgeInsets(
|
|
top: 10,
|
|
left: 10,
|
|
bottom: 10,
|
|
right: 10
|
|
)
|
|
|
|
override func textRect(forBounds bounds: CGRect) -> CGRect {
|
|
layer.borderColor = UIColor.black.cgColor
|
|
layer.borderWidth = 1
|
|
let rect = super.textRect(forBounds: bounds)
|
|
return rect.inset(by: textPadding)
|
|
}
|
|
|
|
override func editingRect(forBounds bounds: CGRect) -> CGRect {
|
|
layer.borderColor = UIColor.black.cgColor
|
|
layer.borderWidth = 1
|
|
let rect = super.editingRect(forBounds: bounds)
|
|
return rect.inset(by: textPadding)
|
|
}
|
|
}
|