iOS开发swift之设置UITextField 占位颜色pla

2020-12-04  本文已影响0人  指尖猿
//
//  UITextField+placeHolderColor.swift
//  Shop
//
//  Created by fox on 2020/11/27.
//  Copyright © 2020 Aos. All rights reserved.
//

import Foundation
extension UITextField{
   @IBInspectable var placeHolderColor: UIColor? {
        get {
            return self.placeHolderColor
        }
        set {
            self.attributedPlaceholder = NSAttributedString(string:self.placeholder != nil ? self.placeholder! : "", attributes:[NSAttributedString.Key.foregroundColor: newValue!])
        }
    }
}

上一篇下一篇

猜你喜欢

热点阅读