编辑UITextField时放大镜的颜色是什么?

时间:2010-09-04 16:53:46

标签: iphone uitextfield

我有一个UITextField,背景颜色设置为ClearColor,文本为白色。该视图的图像为背景暗。

当我想编辑文字时,放大镜背景也是白色或非常浅的颜色,你看不到文字。

如何强制放大镜的背景更暗?

谢谢!

3 个答案:

答案 0 :(得分:0)

UITextField将放大镜背景设置为文本字段的背景颜色。因此,设置backgroundColor的{​​{1}}属性,如下所示:

UITextField

如果您愿意,用另一种深色替换myTextField.backgroundColor = [UIColor blackColor];

答案 1 :(得分:0)

尝试在文字中使用小阴影:

// text shadow
text.layer.shadowRadius = 0.0f;
text.layer.shadowOffset = CGSizeMake(1.0f, 1.0f);
text.layer.shadowColor = [[UIColor colorWithRed:(255.0/255.0) green:(255.0/255.0) blue:(255.0/255.0) alpha:1.0f] CGColor];
text.layer.shadowOpacity = 1.0;

你可以在放大镜色调下阅读文字。

答案 2 :(得分:0)

yakovlev有一个很好的解决方案here,即设置一个合适的backgroundColor,然后以编程方式立即在background后面创建UIView UITextView。< / p>