美文网首页
iOS开发swift之设置UITextField 占位颜色pla

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

作者: 指尖猿 | 来源:发表于2020-12-04 20:26 被阅读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!])
        }
    }
}

相关文章

网友评论

      本文标题:iOS开发swift之设置UITextField 占位颜色pla

      本文链接:https://www.haomeiwen.com/subject/brniwktx.html