iOS 改变UITextField中光标颜色

http://blog.csdn.net/rubycrow/article/details/22411805

方法1:

[objc] view plaincopyprint?

  1. [[UITextField appearance] setTintColor:[UIColor blackColor]];

这种方法将影响所有TextField。

方法2:

[objc] view plaincopyprint?

  1. textField.tintColor = [UIColor redColor];

如果在InterfaceBuilder中修改View的TintColor属性并不好用。

参考http://stackoverflow.com/questions/11606007/change-uitextfield-and-uitextview-cursor-caret-color

时间: 2024-08-28 22:27:23

iOS 改变UITextField中光标颜色的相关文章

IOS 改变字符串中特定字符的颜色和大小。

UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 300)]; lable.text = @"其中俩字是红色,大小为17"; NSRange rangeRmb=[lable.text rangeOfString:[NSString stringWithFormat:@"红色"]]; NSMutableAttributedString *rmbStr=[[NSMutableAtt

改变UITextField的Placeholder颜色

通过 attributedPlaceholder 属性来改变 if([textField respondsToSelector:@selector(setAttributedPlaceholder:)] { UIColor*color =[UIColor blackColor]; textField.attributedPlaceholder =[[NSAttributedString alloc] initWithString:placeholderText attributes:@{NSFo

利用CSS改变输入框的光标颜色

转:http://www.cnblogs.com/gymmer/p/6810367.html 代码: 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Document</title> 6 <style type="text/css"> 7 input,

UITextField 占位符的颜色及光标颜色(及如何学习新知识)

一. 设置光标的颜色 1.如何是xib或storyBoard在设置控件属性找有没有有关颜色的属性(找到了backgroundColor,TextColor,还有一个是tintColor),这样就排除了前两个,试下tintColor,果然有效. 2.如何是用代码写的,可以在UITextField中找相关color,如果没有我们要的属性在父类里找或父类的父类中找,这时找到了这个tintColor. 二.设置点位符的颜色 方法1: 1.因为上面已经找过了没有其它跟颜色相关的属性了,这时我们在UITex

设置 UITextField 的占位符的颜色和光标颜色

这是在 UITextField 类中 /** 运行时 :runtime 可以访问隐藏的一些属性 */ + (void)initialize { [self getIvars]; [self getProperties]; } //获取所有属性 + (void)getProperties { unsigned int count = 0; objc_property_t *properties = class_copyPropertyList([UITextField class], &count

IOS_改变UITextField placeHolder颜色、字体

IOS_改变UITextField placeHolder颜色.字体 我们有时需要定制化UITextField对象的风格,可以添加许多不同的重写方法,来改变文本字段的显示行为.这些方法都会返回一个CGRect结构,制定了文本字段每个部件的边界范围,甚至修改placeHolder颜色,字体. – textRectForBounds:     //重写来重置文字区域 – drawTextInRect:        //改变绘文字属性.重写时调用super可以按默认图形属性绘制,若自己完全重写绘制函

ios设置TextField光标颜色

今天遇到个奇怪的问题,textField不知何时消失了?其实是变成白色了,设置textField的背景色就可以看出来,至于为什么会这样还没找到原因 只能设置光标颜色 1.[textField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"];  这个方法可能在某个时间段有用,但经测试,现在没有效果 2.[UITextField appearance] setTintColor:[UIColor

如何改变vim中的光标形状 : 在插入状态下显示为 beam?而在 其他 状态下 为 block?

分成两种情况来说明: 如果是在 shell 即: gnome-termial终端中, 来启动或 使用 vim的话, 你是 无法 实现这种需求的: 改变vim中的光标形状 : 在插入状态下显示为 beam, 而在 其他 状态下 为 block? 因为 shell下的vim 其光标 始终是由 shell 来 决定的, 也就是说, vim 不是 独立的程序, 它只是寄人篱下, 所以 shell的光标将始终 由shell 来决定, 跟 vim 一点关系都没有, vim 对光标没有影响, 所以, 在she

改变listview中item选中时文字的颜色

当listview的某个item选中时,默认有个选中的高亮显示,如果你要自定义选中时的高亮显示效果,可以在listview中设置属性 1 android:listSelector="@drawable/item_selector" 其中item_selector是在drawable目录下定义的一个xml文件,这种用于突出不同状态下显示效果的xml文件我们称之为selector: 1 2 3 4 5 6 7 <?xml version="1.0" encodin