TableView段标题妙用
来源:互联网 发布:武汉编程辅导班 编辑:程序博客网 时间:2024/06/05 05:09
怎么样把段标题放在旁边与cell平行?
只要两步:
1》
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 1;
}
2》- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *headView = [[UIViewalloc]initWithFrame:CGRectMake(0,0,320,10)];
headView.backgroundColor = [UIColorclearColor];
UIView *blockView = [[UIViewalloc]initWithFrame:CGRectMake(0,0,15,22)];
blockView.backgroundColor = [UIColorgrayColor];
[headViewaddSubview:blockView];
[blockViewrelease];
UIView *lineView = [[UIViewalloc]initWithFrame:CGRectMake(10,0,300,1)];
lineView.backgroundColor = [UIColorgrayColor];
[headViewaddSubview:lineView];
[lineViewrelease];
UILabel *headlabel = [[UILabelalloc]initWithFrame:CGRectMake(0,0,15,22)];
headlabel.text = titleStr;
headlabel.textColor = [UIColorwhiteColor];
headlabel.backgroundColor = [UIColorclearColor];
[headViewaddSubview:headlabel];
[headlabelrelease];
return [headViewautorelease];
}
大功告成!- TableView段标题妙用
- 自定义tableView的标题头
- tableView分组头部标题处理
- 单独刷新tableView的段或者行
- QT设置TableView的标题样式
- iOS--tableview的标题头尾设置
- ios tableview section标题不滑动问题
- ios tableView那些事(四)tableView添加标题,头尾和改变cell的宽度---tableview
- basename妙用于去除字符串结尾某段字符
- tableView段头不能移出屏幕的问题
- tableView左滑删除,自定义标题+cell长按手势
- CollectionView嵌套TableView。页面滑动指向不同的标题
- iOS中tableView组头部和尾部标题设置
- ios tableView那些事(四)tableView添加标题,头尾和改变cell的宽度
- ios tableView那些事(四)tableView添加标题,头尾和改变cell的宽度
- ios tableView那些事(四)tableView添加标题,头尾和改变cell的宽度
- ios tableView (tableView添加标题,头尾和改变cell的宽度)
- ios tableView那些事(四)tableView添加标题,头尾和改变cell的宽度
- 常用的U-boot命令详解
- 光流(optical flow) 光流法(optical flow method) 光流场(optical flow field)
- Form表单提交onSubmit return false失效
- 2、Ant目标详解及使用Ant的各种任务
- (广度、深度)遍历二叉树
- TableView段标题妙用
- 动态绑定 vs 静态绑定
- ffmpeg编译过程遇到的问题
- IOS atomic与nonatomic,assign,copy与retain的定义和区别
- iOS 自定义tabbar
- Java多线程系列之ConcurrentHashMap
- thread 的gettid和pthread_self區别(TODO)
- 利用Apache Common CSV读用逗号分隔的文件
- java遍历Set的三种方式