UITableView在style为plain时,实现sectionHeader跟随cell移动
来源:互联网 发布:mac标点 编辑:程序博客网 时间:2024/05/17 01:15
自定义一个SectionHeaderView,继承自UIView
.h方法
import <UIKit/UIKit.h>@interface SectionHeaderView : UIView@property NSUInteger section;@property (nonatomic, weak) UITableView *tableView;@end
.m方法
import "SectionHeaderView.h"@implementation SectionHeaderView- (void)setFrame:(CGRect)frame{ CGRect sectionRect = [self.tableView rectForSection:self.section]; CGRect newFrame = CGRectMake(CGRectGetMinX(frame), CGRectGetMinY(sectionRect), CGRectGetWidth(frame), CGRectGetHeight(frame)); [super setFrame:newFrame];}@end
使用的时候:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { SectionHeaderView *sectionHead = [[SectionHeaderView alloc] init]; sectionHead.section = section; sectionHead.tableView = tableView; return sectionHead;}
0 0
- UITableView在style为plain时,实现sectionHeader跟随cell移动
- iOS开发~UITableView 在Plain下区头跟随移动
- UITableview Plain风格下 SectionHeader悬浮问题
- UICollectionview实现类似UITableview的sectionheader悬浮代码
- UITableView实现选择框和编辑状态时cell向右移动的自定义方法
- UITableView实现选择框和编辑状态时cell向右移动的自定义方法
- IOS UITableView 移动自定义cell
- UIday1002:UITableView 2 用UITableView实现通讯录cell简单的数据移动、删除、添加功能
- iOS开发:UITableView自定义SectionHeader
- iOS开发~UITableView区头跟随移动
- 点击HeadView 实现对cell动态下拉一个TableView,实现对SectionHeader悬停进行设置
- 如何让 UITableView 的 headerView跟随 cell一起滚动
- 如何让 UITableView 的 headerView跟随 cell一起滚动
- 如何让 UITableView 的 headerView跟随 cell一起滚动
- 如何让 UITableView 的 headerView跟随 cell一起滚动
- 如何让 UITableView 的 headerView跟随 cell一起滚动
- 让UITableView的headerView或footerView跟随cell一起滚动
- 58.UITableView:改变 TableHeaderView 的高度--跟随cell滚动
- QUSTOJ1784 C 机器分配(DP)
- StoryBoard 中使用AutoLayout实现Animation效果
- 1092. To Buy or Not to Buy (20)
- linux wait返回及timer_create问题
- POJ 2001 Shortest Prefixes 数据结构Trie树(字典树、前缀树)
- UITableView在style为plain时,实现sectionHeader跟随cell移动
- Java 8 新特性之 Lambda表达式
- Android学习笔记——触摸事件分发
- 网站优化之如何用原生javascript去完成懒加载技术--lazyload
- POJ-3641 Pseudoprime numbers
- HDU 1052 Tian Ji -- The Horse Racing
- android studio 新建项目 界面一直停在 【“building ‘ 项目名’ gradle project info”】
- Summer day 12
- leetcode_c++:栈:Verify Preorder Serialization of a Binary Tree(331 )