UITableViewCell的选中时的颜色设置

[cpp] view plaincopy

  1. 1.系统默认的颜色设置

[cpp] view plaincopy

  1. //无色
  2. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  3. //蓝色
  4. cell.selectionStyle = UITableViewCellSelectionStyleBlue;
  5. //灰色
  6. cell.selectionStyle = UITableViewCellSelectionStyleGray;

2.自定义颜色和背景设置

 改变UITableViewCell选中时背景色:

UIColor *color = [[UIColoralloc]initWithRed:0.0green:0.0blue:0.0alpha:1];//通过RGB来定义自己的颜色

[html] view plaincopy

  1. cell.selectedBackgroundView = [[[UIView alloc] initWithFrame:cell.frame] autorelease];
  2. cell.selectedBackgroundView.backgroundColor = [UIColor xxxxxx];

3自定义UITableViewCell选中时背景

[html] view plaincopy

  1. cell.selectedBackgroundView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cellart.png"]] autorelease];
  2. 还有字体颜色
  3. cell.textLabel.highlightedTextColor = [UIColor xxxcolor];  [cell.textLabel setTextColor:color];//设置cell的字体的颜色

4.设置tableViewCell间的分割线的颜色

[theTableView setSeparatorColor:[UIColor xxxx ]];

5、设置cell中字体的颜色

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
  if(0 == indexPath.row)
  {
    cell.textLabel.textColor = ...;
    cell.textLabel.highlightedTextColor = ...;
  }
  ...
}

原文地址:http://blog.csdn.net/a6472953/article/details/7532212

时间: 2024-08-24 04:56:02

UITableViewCell的选中时的颜色设置的相关文章

iOS开发UITableViewCell的选中时的颜色设置

1.系统默认的颜色设置 //无色 cell.selectionStyle = UITableViewCellSelectionStyleNone; //蓝色 cell.selectionStyle = UITableViewCellSelectionStyleBlue; //灰色 cell.selectionStyle = UITableViewCellSelectionStyleGray; 2.自定义颜色和背景设置 改变UITableViewCell选中时背景色: UIColor *color

UITableViewCell的选中时的颜色及tableViewCell的selecte与deselecte

    1.系统默认的颜色设置 [cpp] viewplaincopy //无色 cell.selectionStyle = UITableViewCellSelectionStyleNone; //蓝色 cell.selectionStyle = UITableViewCellSelectionStyleBlue; //灰色 cell.selectionStyle = UITableViewCellSelectionStyleGray; 2.自定义颜色和背景设置 改变UITableViewCe

UItableViewCell选中时的颜色及tableviewCell的select和deselect

今天做项目美工和我说cell点击后再跳回当前页面cell的默认点击状态应该取消,后来在网上查到,其实比较简单,有两种实现方法,代码如下 方法一: 在页面将要出现的时候对tableview执行deselect操作 - (void)viewWillAppear:(BOOL)animated{ [self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES]; } 看上面的英文也应

iOS UITabBarItem 选中图的颜色,设置UIimage的渲染模式

UITbarController之前有在这篇文章讲解:http://www.cnblogs.com/niit-soft-518/p/4447940.html 如果自定义了UITabBarItem的图片,用上述文章创建的时候,发现选中的图的边框颜色默认是蓝色的, 解决这个问题就需要设置 UIImage的渲染模式 imageWithRenderingMode 设置UIImage的渲染模式:UIImage.renderingMode 着色(Tint Color)是iOS7界面中的一个.设置UIImag

ios 修改UItableviewcell点击时的颜色

1 UIView *view_bg = [[UIView alloc]initWithFrame:cell.frame]; 2 view_bg.backgroundColor = UIColorFromRGB(0xFFFFFF, 1); 3 cell.selectedBackgroundView = view_bg;

转 Android RadioButton设置选中时文字和背景颜色同时改变

主要应用在购物车,像淘宝的那样,点击以后弹出一个选择种类颜色这样的popuwindow以后,然后这个选择种类的地方要用到类似这个玩意儿. 搜了一下,效果和这个文章一致.转了. 原文地址:http://blog.csdn.net/liuwan1992/article/details/52688408 在使用 RadioButton 时,有时我们会想要达到选中时文字颜色和背景颜色同时改变的效果,这里还需要多进行几步操作. 首先,在布局文件中新建一组 RadioButton : [html] view

android 中改变按钮按下时的颜色

原文出处:http://blog.csdn.net/nmsoftklb/article/details/9087233 a.在开发中大家都会遇到这样情况,在一个xxx.xml文件中如果有两个以上的组件有一样的属性功能时,可以把它们共同的内容抽取出来 放在styles.xml文件来声明. 然后在相应的组件中可以这样引用 : style="@style/widget_listview" style标签也可以这样来定义:res-----values------styles.xml <s

css 修改选中文字的颜色

突然想试着修改一下博客里面文本选中时的颜色,然后就找到了相应的css代码如下: body::selection { color:#FFFFFF; background-color:#E84893; text-shadow:none; } body::-moz-selection { color:#FFFFFF; background-color:#E84893; text-shadow:none; } 效果如下图所示: 1.浏览器默认样式 2.使用上面样式之后

设置UITableViewCell 选中时的背景颜色

自定义Cell如图 一个View上面放了四个Label 分别连线到.m文件中 @property (weak, nonatomic) IBOutlet UILabel *nameLabel; @property (weak, nonatomic) IBOutlet UILabel *positionLabel; @property (weak, nonatomic) IBOutlet UILabel *paperLabel; @property (weak, nonatomic) IBOutle