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

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"]];


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容