怎么实现类似tableview的悬浮header动态改变值

//    self.bb  = [[UILabel alloc]init];
//    self.bb.backgroundColor = [UIColor redColor];
//    [self.view addSubview:self.bb];
//    [self.bb mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.offset(70);
//        make.left.right.offset(0);
//        make.height.offset(40);
//    }];
}
-(void)scrollViewDidScroll:(UIScrollView *)scrollView{

//    [self getNowTopSectionView];
}
//// 获取tableView最上面悬停的SectionHeaderView
//- (void)getNowTopSectionView {
//    NSArray <UITableViewCell *> *cellArray = [self.tableView visibleCells];
//    NSInteger nowSection = -1;
//    if (cellArray) {
//        UITableViewCell *cell = [cellArray firstObject];
//        NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
//        nowSection = indexPath.section;
//    }
//    NSLog(@"当前悬停的组头是:%ld",nowSection);
//    self.bb.text = [NSString stringWithFormat:@"当前是第%ld个分区",nowSection];
//}
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容