【Swift】變更textField預設Placeholder顏色
在AppDelegate的func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool加上UILabel.appearance(whenContainedInInstancesOf: [UITextField.self]).textColor =想要變換的顏色
這樣就可以變更Placeholder的顏色了
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
//調整textField placeholder顏色
UILabel.appearance(whenContainedInInstancesOf: [UITextField.self]).textColor = #colorLiteral(red: 0.137254902, green: 0.137254902, blue: 0.137254902, alpha: 0.44)
return true
}