UITableviewCell点击改变背景颜色, 标题高亮.

 改变UITableViewCell选中时背景色:

  cell.selectedBackgroundView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cellart.png"]] autorelease];   // 点击背景图片

  cell.selectedBackgroundView = [[[UIView alloc] initWithFrame:cell.frame] autorelease];                     cell.selectedBackgroundView.backgroundColor = [UIColor xxxxxx];   // 点击背景颜色

  还有字体颜色

  cell.textLabel.highlightedTextColor = [UIColor xxxcolor];  //设置cell的字体的颜色

  [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 = ...;
  }
  ...
}
时间: 2024-08-08 14:31:05

UITableviewCell点击改变背景颜色, 标题高亮.的相关文章

iOS 创建多个button实现点击改变背景颜色

工程中需要实现与UISegmentedControl效果相似的一排一共十个button,如下图.但是SegmentedControl修改不太方便,就用button替代, 循环创建十个button,点击改变背景色.其他的没被点的button的背景恢复默认.之前也写过,因为button太多,需要各种判断.感觉之前方法的方法比较麻烦. . 第一种方法 在创建button的时候,把所有的button存储到可变数组里,在button点击事件里面,拿到之前的可变数组,对里面的每一个button遍历,遍历的时

Android实现连续并排的若干个TextView单击改变背景颜色达到选项卡Tab栏切换效果

<Android实现连续并排的若干个TextView单击改变背景颜色达到选项卡Tab栏切换效果> 实现的组件交互目的很简单,就是要达到类似tab选项卡的导航栏一样,当用户点击了连续并排的若干个TextView其中之一时候,要产生一定的交互效果(背景颜色改变等).这种实现的方式有不少可选方案,现在通过背景的selector.xml实现. 效果如下: A.初始状态: B.当用户单击了TextView 2,但此时用户的手指一直在按下并未松开的状态,(注意交互设计效果!TextView 2的背景颜色变

jquery改变背景颜色

jquery改变背景颜色<html><head><script type="text/javascript" src="/jquery/jquery.js"></script><script type="text/javascript">$(document).ready(function(){  $("button").toggle(function(){    $

jquery动态改变背景颜色插件

GETHUB下载地址 背景颜色用animate方法时时无法改变颜色的 所以要使用插件进行补充. 用法: <!DOCTYPE html> <html> <head> <style> div { background-color: #bada55; width: 100px; border: 1px solid green; } </style> <script src="http://code.jquery.com/jquery-1

CSS实例:鼠标滑过超级链接文字时改变背景颜色

先讲简单的: 通过CSS可以设置超链接在不同时刻的颜色: <style> a:link {color: #FF0000} /* 未访问的链接 */ a:visited {color: #00FFFF} /* 已访问的链接 */ a:hover {color: #0000FF} /* 鼠标移动到链接上 */ a:active {color: #00FF00} /* 选定的链接 */ </style> <ul id="content"> <li&g

改变背景颜色

//改变背景颜色 protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e) { //如果是绑定数据行 if (e.Row.RowType == DataControlRowType.DataRow) { //鼠标经过时,行背景色变 e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#ffa501'&qu

锐浪 报表, 交叉报表中 对交叉字段,做条件改变背景颜色 .

var fieldCount = Report.RunningDetailGrid.ColumnContent.ContentCells.Count; // 总字段列数 var lockFieldCount = Report.DetailGrid.CrossTab.ListCols; // 锁定字段列数 var crossFieldCount = fieldCount - lockFieldCount; for(var colIndex = 1; colIndex <=crossFieldCou

eclipse改变背景颜色

eclipse eclipse默认的背景颜色好丑,肿么办!看的时间太长,眼镜太干 把eclipse改成保护色 在这个网站下载主题:eclipsecolorthemes.org 进入这个官网来找自己喜欢的背景色 选择一个自己喜欢的主题,然后进入下载.这里我选择Sublime Text2的主题进入.进入之后大概是这个样子,选择EPF文件下载. 然后再项目区->import选择General->Preferences选择之前下载的epf文件->Finish.即可 配置完成之后,大家会看到只有代

eclipse中调整字体大小和改变背景颜色

调整字体大小: Window-Preferences-General-Appearence-Colors And Fonts 修改背景颜色: windows->Preferences->General->Editor->Text Editors右边选择Appearance color options 选Background color 选择背景颜色 背景颜色推荐:色调:85 饱和度:123 亮度:205