1
extension UITextField
@IBInspectable var placeholdercolor: UIColor
{
willSet {
attributedPlaceholder = NSAttributedString(string: placeholder != nil ? placeholder! : "", attributes:[NSAttributedStringKey.foregroundColor: placeholdercolor])
}}
プレースホルダーカラー用のUITextFieldの拡張機能を作成しています。私は、カスタムクラスを作成したくないと私はまた、拡張機能には、UItextfieldに格納されたプロパティが含まれていない可能性があります。
@IBInspectable var placeholdercolor: UIColor
{
get
{
return self.placeholdercolor
}
set
{
attributedPlaceholder = NSAttributedString(string: placeholder != nil ? placeholder! : "", attributes:[NSAttributedStringKey.foregroundColor: placeholdercolor])
}
}
を試みるが、それはエラーに(スレッド1:EXC_BAD_ACCESS)を与えている方法
get
{
return self.placeholdercolor
}
に