Hi. TextField have a placeHolder property to set placeholder. This tutorial for set colour of placeHolder in textField. There are two ways to set textfield placeholder colour. One is programmatically and second one is using runtime attribute.
This tutorial is working on Swift 3.0.
1. textFiled placeholder Programmatically :
var myMutableStringTitle = NSMutableAttributedString() let Name = "Email ID" // PlaceHolderText myMutableStringTitle = NSMutableAttributedString(string:Name, attributes: [NSFontAttributeName:UIFont(name: "Georgia", size: 18.0)!]) // Font myMutableStringTitle.addAttribute(NSForegroundColorAttributeName, value: UIColor.red, range:NSRange(location:0,length:Name.characters.count)) // Color txtEmailID.attributedPlaceholder = myMutableStringTitle
txtPassword.attributedPlaceholder = NSAttributedString(string:"Password", attributes: [NSForegroundColorAttributeName: UIColor.green])
2. textFiled placeholder runtime attribute:
1. Set textFiled placeholder text : Confirm Password
2. Select identity inspector on textfield property. and set userDefine runtime attribute of placeholder colour.
Key Path : _placeholderLabel.textColor
OutPut :
Thanks.
Source: iosdevcenters.blogspot.com
2. Select identity inspector on textfield property. and set userDefine runtime attribute of placeholder colour.
Key Path : _placeholderLabel.textColor
Type : Color
Value : _Color or RGB value.
OutPut :
Thanks.