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

//
//  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!])
        }
    }
}

你可能感兴趣的:(iOS开发swift之设置UITextField 占位颜色placeHolderColor)