34 lines
848 B
Swift
34 lines
848 B
Swift
//
|
|
// ap_textF.swift
|
|
// Hthik
|
|
//
|
|
// Created by 忆海16 on 2024/5/31.
|
|
// Copyright © 2024 Hthik. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import UIKit
|
|
|
|
class TextFieldModifier {
|
|
|
|
// 设置 TextField 的文本
|
|
static func setText(of textField: UITextField, to text: String) {
|
|
textField.text = text
|
|
}
|
|
|
|
// 修改 TextField 的文本颜色
|
|
static func setTextColor(of textField: UITextField, to color: UIColor) {
|
|
textField.textColor = color
|
|
}
|
|
|
|
// 设置 TextField 的占位符
|
|
static func setPlaceholder(of textField: UITextField, to placeholder: String) {
|
|
textField.placeholder = placeholder
|
|
}
|
|
|
|
// 设置 TextField 的键盘类型
|
|
static func setKeyboardType(of textField: UITextField, to type: UIKeyboardType) {
|
|
textField.keyboardType = type
|
|
}
|
|
}
|