//Section的标题栏高度
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
if (section == )
return ;
else
return 30.0f;
} -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
CGRect headerFrame = CGRectMake(, , , );
CGFloat y = ;
if (section == ) {
headerFrame = CGRectMake(, , , );
y = ;
}
UIView *headerView = [[UIView alloc] initWithFrame:headerFrame];
UILabel *dateLabel=[[UILabel alloc] initWithFrame:CGRectMake(, y, , )];//日期标签
dateLabel.font=[UIFont boldSystemFontOfSize:16.0f];
dateLabel.textColor = [UIColor darkGrayColor];
dateLabel.backgroundColor=[UIColor clearColor];
UILabel *ageLabel=[[UILabel alloc] initWithFrame:CGRectMake(, y, , )];//年龄标签
ageLabel.font=[UIFont systemFontOfSize:14.0];
ageLabel.textAlignment=UITextAlignmentRight;
ageLabel.textColor = [UIColor darkGrayColor];
ageLabel.backgroundColor=[UIColor clearColor]; NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateFormat = @"MM dd,yyyy";
dateLabel.text = [NSString stringWithFormat:@"%@",[dateFormatter stringFromDate:[NSDate date]]];
ageLabel.text = @"1岁 2天"; [headerView addSubview:dateLabel];
[headerView addSubview:ageLabel];
return headerView;
}

ios 自定义UITableView中分组的标题sectionview的更多相关文章

  1. iOS之UITableView中的cell因为重用机制导致新的cell的数据出现重复或者错乱

      UITableView中的cell可以有很多,一般会通过重用cell来达到节省内存的目的:通过为每个cell指定一个重用标识符(reuseIdentifier),即指定了单元格的种类,当cell滚 ...

  2. iOS解决UITableView中Cell重用带来的问题

    tableView的常规配置,当超出一屏的cell就会标上可重用的标识出列到可重用缓存池中,后面再根据可重用标识来到的可重的cell就会和前面显示同样内容. - (UITableViewCell *) ...

  3. ios 更改UITableview中Section的字体颜色

    -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { UILabel *c ...

  4. iOS设置UITableView中Cell被默认选中后怎么触发didselect事件

    //默认选中某个cell [self.searchResultTV selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] a ...

  5. iOS 如何自定义UISearchBar 中textField的高度

    iOS 如何自定义UISearchBar 中textField的高度 只需设置下边的方法就可以 [_searchBar setSearchFieldBackgroundImage:[UIImage i ...

  6. (Ios 实战) 自定义UITableView

    自定义UITableView 分成两个部分 1 自定义UITableViewCell 继承UITableViewCell,同时提供接口,根据当前的数据,现实View 2  在UITableView中实 ...

  7. ios UITableView中Cell重用机制导致内容重复解决方法

    UITableView继承自UIScrollview,是苹果为我们封装好的一个基于scroll的控件.上面主要是一个个的 UITableViewCell,可以让UITableViewCell响应一些点 ...

  8. iOS学习之UITableView中Cell的操作

    接着iOS学习之Table View的简单使用 这篇,这里主要讲UITableView 中的Cell的操作,包括标记.移动.删除.插入. 为了简单快捷,直接从原来那篇的代码开始,代码下载地址:http ...

  9. iOS开发之UITableView中计时器的几种实现方式(NSTimer、DispatchSource、CADisplayLink)

    最近工作比较忙,但是还是出来更新博客了.今天博客中所涉及的内容并不复杂,都是一些平时常见的一些问题,通过这篇博客算是对UITableView中使用定时器的几种方式进行总结.本篇博客会给出在TableV ...

随机推荐

  1. @Autowired和@Resource装配

    从Spring2.5開始就能够使用注解自己主动装配Bean的属性. 使用注解自己主动装配与XML中使用autowire属性自己主动装配并没有太大区别. Spring容器默认禁用注解装配. 所以在基于注 ...

  2. 页面局部加载,适合Ajax Loading场景(Demo整理)

    效果图: 完整demo下载

  3. 在ubuntu下安装free pascal

    1.ubuntu16.04版本已经集成了free pascal最新的3.0版,只需要安装就可以了. sudo apt install fp-compiler 在ubuntu里面,fp-compiler ...

  4. 李洪强漫谈iOS开发[C语言-053]-小结

    /* 已经学习过的C语言语法 01 基本C程序结构 int main (void) int main(int argc,char *arv){...} 02 基本语句(输入输出) 基本头文件: #in ...

  5. 0073 javacTask: 源发行版 1.8 需要目标发行版 1.8

    今天在编译执行下面这段代码的时候,编译报错:javacTask: 源发行版 1.8 需要目标发行版 1.8 public class Test { public static void main(St ...

  6. oracle 存储过程学习感悟

    1.跟大白话差不多 2.if...then.... else ....写的比较多 3.调用存储过程命令:execute procedure_name 4.调用存储函数命令:select '0' str ...

  7. 三篇很好的讲解keppalived的博客

    VRRP协议介绍 参考资料: RFC 3768 1. 前言 VRRP(Virtual Router Redundancy Protocol)协议是用于实现路由器冗余的协议,最新协议在RFC3768中定 ...

  8. netctl

    netctl is a CLI-based tool used to configure and manage network connections via profiles. It is a na ...

  9. oozie客户端常用操作命令

    1.提交作业,作业进入PREP状态 oozie job -oozie http://localhost:11000/oozie -config job.properties -submit job: ...

  10. 用Netty开发中间件:高并发性能优化(转)

    用Netty开发中间件:高并发性能优化 最近在写一个后台中间件的原型,主要是做消息的分发和透传.因为要用Java实现,所以网络通信框架的第一选择当然就是Netty了,使用的是Netty 4版本.Net ...