iOS 8文本字段色调颜色

Jac*_*mon 8 xcode tint objective-c ios ios8

在iOS 7中,更改uitextfield的"tint color"属性会更改该文本字段的光标颜色.在iOS 8中,即使我更改全局故事板色调颜色,也不会发生这种情况(objective-c,仍然适用于iOS 7).我该如何解决?

nic*_*sso 12

我只是试图复制你的问题但是在iOS7.1和iOS8上,文本字段的tintColor属性都能很好地工作.

这行代码更改了textField的光标颜色.试试这个而不是改变Storyboard中的色调颜色

textField.tintColor = [UIColor colorWithRed:98.0/255.0f green:98.0/255.0f blue:98.0/255.0f alpha:1.0];
Run Code Online (Sandbox Code Playgroud)

希望能帮助到你!

  • 这应该是被接受的.我仍然没有得到它,为什么它不能通过故事板. (4认同)

Geo*_*kin 8

尝试以下方法:

[[self.textField setTintColor:[UIColor blueColor]];

[self.textField setTintAdjustmentMode:UIViewTintAdjustmentModeNormal];
Run Code Online (Sandbox Code Playgroud)

  • 谢谢.没有`self.tintAdjustmentMode = UIViewTintAdjustmentModeNormal;`设置tintColor将不起作用. (2认同)