iOS应用开发新手上路(三):UITableViewCell的自定义

来源:互联网 发布:java 引用其他文件方法 编辑:程序博客网 时间:2024/05/18 00:57

UITableView是iOS应用中最常使用的控件之一,而通过对其中的UITableViewCell的自定以更可以实现很多不同的显示效果。

UITableViewCell包含以下四种风格:

1.      UITableViewCellStyleDefault:



2.      UITableViewCellStyleSubtitle:



3.      UITableViewCellStyleValue1



4.      UITableViewCellStyleValue2



通过设置UItableViewCell的textLable的lineBreakMode和Lines属性,可以使得textLable识别‘\n’等转义字符并显示多行文本。


[cell.textLable setLineBreakMode:NSLineBreakByWordWrapping];[cell.textlable setNumberOfLines:0];

通过设置UITableViewCell的backgroundColor和backgroundView可以使UItableViewCell具有透明效果。


cell.backgroundColor = [UIColor clearColor];cell.backgroundView = [[UIView alloc] initWithFrame:CGRectZero];


原创粉丝点击