iOS tableview viewForHeaderInSection 自定义
2014-08-30 11:08
411 查看
- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { UIView *view = [[UIView alloc] init]; //设置 title 区域 UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, tableView.contentSize.width, 20)]; //设置 title 文字内容 titleLabel.text = @"标题内容"; //设置 title 颜色 titleLabel.textColor = [UIColor colorWithRed:221/255.0 green:61/255.0 blue:47/255.0 alpha:1]; [view addSubview:titleLabel]; return view; } - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { //设置 title 区域高度 return 40.f; }
效果图:
相关文章推荐
- ios:改变tableview的titleForHeaderInSection字体颜色设置
- ios开发之--ios11适配:TableView的heightForHeaderInSection设置高度无效/UISearchBar消失
- 【iOS】tableView:viewForHeaderInSection: 方法未调用
- UITableView的tableHeaderView和viewForHeaderInSection區別
- ios tableView 的header for section无法加载的问题
- TableView viewForHeaderInSection 随滚动条滚动 无遮挡
- - (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
- tableView视图列表1: titleForHeaderInSection
- 自定义viewForHeaderInSection、自定义组头的显示
- 如何设置不同组section的的头部高度?tableView heightForHeaderInSection
- iOS开发:Xcode 7之后viewForHeaderInSection、viewForFooterInSection设置内容不产生效果的解决方法
- 折叠表格思路及遇到的问题(tableView:viewForHeaderInSection:的section从1开始,不是从0开始)
- 【iOS开发】关于Xcode8后产生的viewForHeaderInSection、viewForFooterInSection设置不产生效果的问题
- iOS开发UI— QQ好友列表(处理头部控件的点击)viewForHeaderInSection:
- iOS开发笔记--去掉tableview中section的headerview粘性
- Table View Programming Guide for iOS---(一)---About Table Views in iOS Apps
- iOS开发笔记--去掉tableview中section的headerview粘性
- iOS中tableView每一个section的header的悬浮位置的解决
- UITableView heightForHeaderInSection遇到的坑
- 自定义tableView的section header/footerView时的view复用问题