在文本字段中更改光标的颜色 [英] Change color of cursor in text field
问题描述
如何在我的文本字段中更改光标的颜色?
code> UITextField 的
您可以在代码中执行此操作...
textField.tintColor = [UIColor redColor];
...或在Interface Builder中:
您还可以使用 UITextField
外观代理对您应用程序中的所有文本字段执行此操作:
[[UITextField appearance] setTintColor:[UIColor redColor]];
下面是模拟器屏幕截图,显示了其他普通iOS 7文本字段的外观,其色调设置为红色
$ b
文字选择屏幕截图:
How can I change the color of the cursor in my text field?
With iOS 7 you can simply change tintColor
property of the UITextField
. This will affect both the color of the text cursor and the text selection highlight color.
You can do this in code...
textField.tintColor = [UIColor redColor];
... or in Interface Builder:
You can also do this for all text fields in your app using the UITextField
appearance proxy:
[[UITextField appearance] setTintColor:[UIColor redColor]];
Below are simulator screenshots showing what an otherwise ordinary iOS 7 text field looks like with its tint set to red.
Text cursor screenshot:
Text selection screenshot:
这篇关于在文本字段中更改光标的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!