iOS开发笔记--cell最右边显示箭头,字符,自定义分割线
来源:互联网 发布:mac下制作dmg到u盘 编辑:程序博客网 时间:2024/06/06 08:50
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- static NSString *CellIdentifier = @"Cell";
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:
- CellIdentifier];
- if (0 == indexPath.section) {
- cell = [[[UITableViewCell alloc]
- initWithStyle:UITableViewCellStyleDefault
- reuseIdentifier:CellIdentifier] autorelease];
- if (0 == indexPath.row) {
- cell.textLabel.text = @"新浪微博"; //cell的text内容
- UIView *lbl = [[UIView alloc] init]; //定义一个label用于显示cell之间的分割线(未使用系统自带的分割线),也可以用view来画分割线
- lbl.frame = CGRectMake(cell.frame.origin.x + 10, cell.frame.size.height - 5, cell.frame.size.width - 20, 1);
- lbl.backgroundColor = [UIColor lightGrayColor];
- [cell.contentView addSubview:lbl];
- [lbl release];
- }
- UILabel *label = [[UILabel alloc] init]; //定义一个在cell最右边显示的label
- label.text = @"Dark0921";
- label.font = [UIFont boldSystemFontOfSize:14];
- [label sizeToFit];
- label.backgroundColor = [UIColor clearColor];
- if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
- label.frame =CGRectMake(SCREEN_WIDTH - label.frame.size.width - 10,\
- 12, label.frame.size.width, label.frame.size.height);
- } else {
- label.frame =CGRectMake(SCREEN_WIDTH - label.frame.size.width - 20,\
- 12, label.frame.size.width, label.frame.size.height);
- }
- [cell.contentView addSubview:label];
- label.backgroundColor = [UIColor clearColor];
- label.textColor = [UIColor grayColor];
- [label release];
- }
- else if (1 == indexPath.row){
- cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; //显示最右边的箭头
- cell.textLabel.text = @"添加好友";
- }
- }
- return cell;
- }
0 0
- iOS开发笔记--cell最右边显示箭头,字符,自定义分割线
- iOS开发笔记--cell最右边显示箭头,字符,自定义分割线
- iOS开发笔记--cell最右边显示箭头,字符,自定义分割线
- tableview属性 不显示cell分割线,右边小箭头取消选中 iOS 新手笔记
- iOS-UITableView 右侧箭头+取消分割线+取消选中样式+自定义分割线(原生和自定义cell)
- iOS开发技巧-tableView去掉多余的空行分割线,自定义Cell分割线
- ios开发技巧之tableView去掉多余的空行分割线 自定义cell分割线
- iOS开发技巧-tableView去掉多余的空行分割线,自定义Cell分割线
- iOS中 自定义cell分割线/分割线偏移
- IOS 自定义cell 分割线不完整
- iOS cell分割线从头显示
- 自定义cell分割线
- 【iOS开发系列】cell分割线置顶
- ios 隐藏cell分割线和自定义cell分割线颜色
- iOS 开发中用模拟器跑程序时cell的分割线一直不显示
- iOS开发:iOS TableViewCell自定义分割线
- iOS开发:iOS TableViewCell自定义分割线
- IOS 自定义UITableViewCell:Cell高度、分割线、间距等
- iOS发布app到App Store教程
- batch bat文件是dos下的批处理文件
- #学习笔记#(26)CSS3总结-慕课教程(部分)
- 繁华与落寞不过是过眼烟云
- linux常见基本命令之十八dd
- iOS开发笔记--cell最右边显示箭头,字符,自定义分割线
- 本人在安卓程序开发时用到的各种小功能(一) 屏幕截图
- iOS开发笔记--使用blend改变图片颜色
- u-boot-2016.01分析s3c2410启动过程
- 黑马程序员 OC中的block的基础理解
- 两种方式获取Thrift调用的客户端IP地址
- iOS开发笔记--图片拉伸技巧
- 常用算法——快速排序
- Xcode 插件优缺点对比(推荐 20 款插件)