iOS-UITableViewStylePlain与UITableViewStyleGro。。。

iOS-UITableViewStylePlain与UITableViewStyleGro。。。

2023年7月13日发(作者:)

iOS-UITableViewStylePlain与UITableViewStyleGro。。。⼀、UITableViewStylePlain1.有多段时 段头停留(⾃带效果)2.没有中间的间距和头部间距(要想有的重写UITableViewCell UITableViewHeaderFooterView⾥⾯的setFrame⽅法)扩展:让段头不停留(取消粘性效果)- (void)scrollViewDidScroll:(UIScrollView *)scrollView { CGFloat sectionHeaderHeight = 30; if (tOffset.y<=sectionHeaderHeight&&tOffset.y>=0) { tInset = UIEdgeInsetsMake(-tOffset.y, 0, 0, 0); } else if (tOffset.y>=sectionHeaderHeight) { tInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0); }}

⼆、UITableViewStyleGroup注意:去掉头部和中间间隔正确的理解⽅法1.设置标头的⾼度为特⼩值 (不能为零 为零的话苹果会取默认值就⽆法消除头部间距了)UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, , 0.001)];oundColor = [UIColor redColor];eaderView = view;2.写代理⽅法(中间的留⽩其实是段尾的⾼度 代理的作⽤设置段尾的⾼度 返回值也不能为0)-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{return 0.01f;}

特殊的处理⽅法也能实现该效果1. tInset = UIEdgeInsetsMake(-44, 0, 0, 0);

2.重写UITableViewHeaderFooterView的-(void)setFrame:(CGRect)frame{+=10;[super setFrame:frame];}

发布者:admin,转转请注明出处:http://www.yc00.com/news/1689262861a226341.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信