让UITableView的section header view不悬停的方法
2016-07-01 10:49
459 查看
原文 http://www.codingtime.info/post/posts/leng-zhi-shi/2015_1_5_uitableview_section_header
主题 UITableView
当
header在滚动时会默认悬停在界面顶端。取消这一特性的方法有两种:
将
header都会随着scrollview滚动了。不过
重载scrollview的delegate方法
主题 UITableView
当
UITableView的
style属性设置为
Plain时,这个tableview的section
header在滚动时会默认悬停在界面顶端。取消这一特性的方法有两种:
将
style设置为
Grouped。这时所有的section
header都会随着scrollview滚动了。不过
grouped和
plain的样式有轻微区别,切换样式后也许需要重新调整UI
重载scrollview的delegate方法
- (void)scrollViewDidScroll:(UIScrollView *)scrollView { CGFloat sectionHeaderHeight = 40; 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); } }
相关文章推荐
- UIViewController 间的传值方式
- 19 C#循环语句的跳过和中断 continue和break
- indent guides 格式化代码(添加竖线)
- ios开发之uiTableView增加搜索框
- android stuido You can quickly navigate in the currently edited file with Ctrl+F12 (Navigate | File
- CUICatalog: Invalid asset name supplied:
- fuel8:fuel master安装失败的处理
- NGUI 背包系统的拖拽
- Your build settings specify a provisioning profile with the UUID, no provisioning profile was found
- UIButton的titleLabe setAttributeSting 首次不起作用
- require.js理解
- Git Commands Quick Notes
- servlet转发与重定向基本概念与区别
- iOS学习之TableView和UIScrollView的综合小应用
- iOS 自动布局 两个UILabel 迷思
- String StringBuilder StringBuffer 对比 总结得非常好
- 绘制像素到屏幕上
- BlockingQueue深入分析
- double frequency=cv::getTickFrequency(); const int64 start=cv::getTickCount();
- alias, bg, bind, break, builtin, caller, cd, command,