下拉刷新时UITableView的section headerView冲突的解决
2016-01-26 17:37
204 查看
1、如果选择不让HeaderView悬浮
- (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);
}
}
2、如果选择让HederView悬浮
if scrollView.isEqual(scheduleTableView){
let sectionHeaderHeight:
CGFloat = 44;
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 =
UIEdgeInsetsZero
}
}
处理完成以后,然后
strongSelf.scheduleTableView.scrollToRowAtIndexPath(indexArray.index, atScrollPosition: .Middle,
animated: false) 滚动到指定行,完成效果
参考:http://blog.csdn.net/hopedark/article/details/44175695
http://www.geekcome.com/content-10-2518-1.html
- (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);
}
}
2、如果选择让HederView悬浮
if scrollView.isEqual(scheduleTableView){
let sectionHeaderHeight:
CGFloat = 44;
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 =
UIEdgeInsetsZero
}
}
处理完成以后,然后
strongSelf.scheduleTableView.scrollToRowAtIndexPath(indexArray.index, atScrollPosition: .Middle,
animated: false) 滚动到指定行,完成效果
参考:http://blog.csdn.net/hopedark/article/details/44175695
http://www.geekcome.com/content-10-2518-1.html
相关文章推荐
- 设备管理,连接两个数据库,用的easygui
- 如何创建UIlabel,使label的高度随着内容的多少而变动并且可以设置行间距?
- NSString, char, NSData,UIImage相互转化
- virt-install Guest name 'test' is already in use解决办法
- iOS 瀑布流的简单实现 UICollectionView
- Android Bluetooth笔记
- leetcode 63. Unique Paths II
- Lucene BooleanQuery实现
- It is indirectly referenced from required .class files
- 函数参数之 传常引用(passed by reference to const)替换 传值(passed by value)
- 使用UICollectionView 重写UICollectionViewLayout实现瀑布流
- DSP/BIOS 线程控制 MBX SEM QUE模块API
- DSP/BIOS任务通信和同步 MBX SEM QUE模块API
- Android UI开发之Action Bar
- iOS Auto Layout UIView Drawing cycle - stackoverflow
- * 重新绘制UITableViewCell线的方法
- UITextView设置输入个数限制
- Java控制语句——break和continue
- UILabel详解
- ios界面UICollectionView