简体   繁体   中英

How to change text selection color of UITextField?

Xcode9.2, iOS 11, swift

I'm working on a project where user have to enter some text using Keyboard. User can use English & Japanese keyboard. now, when i start typing using English keyboard it works good no problem at all. but when i change keyboard to Japanese and start entering a same character multiple times. it shows selected text in UITextField .

here is my UITextField setup,

    self.tf.font = self.font
    self.tf.textAlignment = .center
    self.tf.returnKeyType = .done
    self.tf.inputAccessoryView = nil
    self.tf.text = " "
    self.tf.tintColor = UIColor.clear
    self.tf.textColor = UIColor.darkGray

要更改UITextField的文本选择颜色,只需更改tint color属性:

textField.tintColor = UIColor.purple

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM