tableview 的格式为UITableViewStylePlain,去掉headerview的黏连性
2015-02-09 16:27
363 查看
在viewcontroller中实现如下方法 - (void)scrollViewDidScroll:(UIScrollView *)scrollView { if (scrollView == _table) { CGFloat sectionHeaderHeight = 50; if (scrollView.contentOffset.y<=sectionHeaderHeight&&scrollView.contentOffset.y>=0) { scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0); } else if (scrollView.contentOffset.y>=sectionHeaderHeight) { scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0); } } }如果是ios7版本以上在viewdidload 实现以下代码,否则会出现滑动后区头被导航条遮住
if ([[[UIDevice currentDevice]systemVersion]floatValue]>=7.0) { self.edgesForExtendedLayout = UIRectEdgeNone; }
相关文章推荐
- 使 UITableViewStylePlain Style 的TableView header 不浮动,像Group Style 那样固定,跟随Tableview 滚动,而不会停在顶端。
- 去掉UITableViewStylePlain样式下Section停留问题
- UITableView UITableViewStylePlain模型下 取消headerView的黏结性
- 【技巧】UITableView 在UITableViewStylePlain模型下,取消headerView的黏结性,不浮动
- UITableViewStyleGrouped和plain的两种格式的区别
- 解决IOS中UITableViewStylePlain 时对headerview的隐藏
- UITableViewStyleGrouped和plain的两种格式的区别
- UITableViewStylePlain与UITableViewStyleGroup样式的对比
- 解决UItableView cell的间隔线 separatorStyle ( plain group 两种类型)
- 去掉UItableview headerview(组标题)黏性
- iOS 去掉UItableview header(footer)view黏性(sticky)?
- 去掉UItableview header(footer)view黏性
- iOS设置tableViewCell之间的间距(去掉UItableview headerview黏性)
- 如何去掉UItableview header(footer)view黏性(sticky)?
- UITableView去掉headerView和footerView的粘性,随tableview滚动(有瑕疵)
- uitableview style类型为Grouped时,去掉上面空白的方法
- 去掉UItableview header(footer)view黏性(sticky)
- 去掉UItableview header(footer)view黏性(sticky)
- UITableViewStylePlain实现分组效果
- UITableView UITableViewStylePlain UITableViewStyleGrouped