美文网首页
iOS碎片笔记-UItableView的相关方法设置

iOS碎片笔记-UItableView的相关方法设置

作者: 呉囲仌犮yzx | 来源:发表于2016-06-29 16:49 被阅读42次

UItableView的相关方法设置

(1)TableView显示detailLabel的方法,设置cell的type:

cell = [[BaseTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1reuseIdentifier:identifier];

(2)显示右边向导图片的方法:

cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

(3)TableView自适应高度设置

self.couponTableView.rowHeight = UITableViewAutomaticDimension;

self.couponTableView.estimatedRowHeight = 100;

(4)TableView隐藏点击效果

<1>关闭交互

<2>设置点击效果 : cell.selectionStyle = UITableViewCellSelectionStyleNone;

<3>设置selectedBackgroundView替换原来的

UIView *view_bg = [[[UIView alloc]initWithFrame:cell.frame]autorelease];

view_bg.backgroundColor = [UIColor clearColor];

cell.selectedBackgroundView = view_bg;

(5)设置tableViewCell分割线条的颜色

[theTableView setSeparatorColor:[UIColorredColor]];

(6)设置tableViewCell点击时候的背景色

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

cell.selectedBackgroundView=[[[UIViewalloc]initWithFrame:cell.frame]autorelease];

cell.selectedBackgroundView.backgroundColor=[UIColorredColor];

(7)设置tableViewCell选中背景

cell.selectedBackgroundView=[[[UIImageViewalloc]initWithImage:[UIImageimageNamed:@"cellart.png"]]autorelease];

还有字体颜色

cell.textLabel.highlightedTextColor=[UIColorxxxcolor];[cell.textLabel setTextColor:color]

cell.textLabel.opaque = NO; //文本的地方设置透明色

(8)设置tableViewCell的一些系统设置

//无色

cell.selectionStyle=UITableViewCellSelectionStyleNone;

//蓝色

cell.selectionStyle=UITableViewCellSelectionStyleBlue;

//灰色

cell.selectionStyle=UITableViewCellSelectionStyleGray;

(9)通过图片获取颜色

[UIColorcolorWithPatternImage:[UIImageimageNamed:@"imageName"]];


相关文章

网友评论

      本文标题:iOS碎片笔记-UItableView的相关方法设置

      本文链接:https://www.haomeiwen.com/subject/qydxjttx.html