台湾黄姓小模,小喇叭故事网,侯卫东官场笔记
ios uitableview颜色设置的实例详解
1.系统默认的颜色设置
//无色 cell.selectionstyle = uitableviewcellselectionstylenone; //蓝色 cell.selectionstyle = uitableviewcellselectionstyleblue; //灰色 cell.selectionstyle = uitableviewcellselectionstylegray;
2.自定义颜色和背景设置
改变uitableviewcell选中时背景色:
uicolor *color = [[uicoloralloc]initwithred:0.0green:0.0blue:0.0alpha:1];//通过rgb来定义自己的颜色 [html] view plaincopy cell.selectedbackgroundview = [[[uiview alloc] initwithframe:cell.frame] autorelease]; cell.selectedbackgroundview.backgroundcolor = [uicolor xxxxxx];
3自定义uitableviewcell选中时背景
cell.selectedbackgroundview = [[[uiimageview alloc] initwithimage:[uiimage imagenamed:@"cellart.png"]] autorelease]; 还有字体颜色 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 = ...; } ... }
以上就是ios uitableview颜色设置的几种方法,如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
iOS 使用UITextField自定义搜索框 实现用户输入完之后“实时搜索”功能
网友评论