Commit 1f0ecf1f authored by Steven杜宇's avatar Steven杜宇

// 文件清单

parent 352fd929
......@@ -54,7 +54,6 @@ class YHMyFileListViewController: YHBaseViewController {
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = UIColor.init(hex: 0xDCE4F1)
tableView.separatorStyle = .none
tableView.bounces = false
tableView.register(YHMyFileListCell.self, forCellReuseIdentifier: YHMyFileListCell.cellReuseIdentifier)
tableView.register(YHMyFileListNoneCell.self, forCellReuseIdentifier: YHMyFileListNoneCell.cellReuseIdentifier)
tableView.delegate = self
......@@ -241,12 +240,12 @@ class YHMyFileListViewController: YHBaseViewController {
}
let offsetY = self.tableView.contentOffset.y-k_Height_NavigationtBarAndStatuBar-self.topSegmentHeight+gap
let maxOffSetY = self.tableView.contentSize.height-self.tableView.frame.size.height
if abs(offsetY) <= maxOffSetY {
// if abs(offsetY) <= maxOffSetY {
// 此处+2是弥补section结合处偏差与tab显示
self.tableView.setContentOffset(CGPointMake(0, offsetY+4), animated: false)
} else {
self.tableView.setContentOffset(CGPointMake(0, maxOffSetY-1), animated: false)
}
// } else {
// self.tableView.setContentOffset(CGPointMake(0, maxOffSetY-1), animated: false)
// }
})
}
}
......@@ -385,27 +384,49 @@ extension YHMyFileListViewController : UITableViewDelegate, UITableViewDataSourc
self.topSegmentView.isHidden = scrollView.contentOffset.y < gap
// 滚动到哪个section 对应的segment要显示相应的index
// if items.count > 0 {
// var arr:[Double] = []
// for index in 0..<items.count {
// let rect = self.tableView.rectForHeader(inSection: index)
// let y = rect.origin.y-k_Height_NavigationtBarAndStatuBar-self.topSegmentHeight
// arr.append(y)
// }
//
// for (index, offY) in arr.reversed().enumerated() {
// if index == arr.count-1 {
// self.topSegmentView.updateSelectIndex(arr.count-index-1)
// self.segmentView.updateSelectIndex(arr.count-index-1)
// break
//
// } else {
// if scrollView.contentOffset.y >= offY+2 {
// self.topSegmentView.updateSelectIndex(arr.count-index-1)
// self.segmentView.updateSelectIndex(arr.count-index-1)
// break
// }
// }
// }
// }
var find:Bool = false
if items.count > 0 {
var arr:[Double] = []
for index in 0..<items.count {
let rect = self.tableView.rectForHeader(inSection: index)
let y = rect.origin.y-k_Height_NavigationtBarAndStatuBar-self.topSegmentHeight
arr.append(y)
for (index, offY) in arr.reversed().enumerated() {
if index == arr.count-1 {
self.topSegmentView.updateSelectIndex(arr.count-index-1)
self.segmentView.updateSelectIndex(arr.count-index-1)
break
} else {
if scrollView.contentOffset.y >= offY+2 {
self.topSegmentView.updateSelectIndex(arr.count-index-1)
self.segmentView.updateSelectIndex(arr.count-index-1)
// section 到顶部选择tab的距离
let y = rect.origin.y-k_Height_NavigationtBarAndStatuBar-self.topSegmentHeight+24.0-self.tableView.contentOffset.y
if 0.0 <= y, y < self.tableView.height-k_Height_NavigationtBarAndStatuBar-self.topSegmentHeight {
find = true
self.topSegmentView.updateSelectIndex(index)
self.segmentView.updateSelectIndex(index)
break
}
}
}
// section 没有在可见区域出现
if !find {
if let arr = self.tableView.indexPathsForVisibleRows, let lastIndexPath = arr.last {
self.topSegmentView.updateSelectIndex(lastIndexPath.section)
self.segmentView.updateSelectIndex(lastIndexPath.section)
}
}
}
......
......@@ -101,7 +101,6 @@ class YHSegmentView: UIView {
let selectIndex = view.tag-self.itemBaseTag
self.selectIndex = selectIndex
self.selectBlock?(selectIndex)
updateSelectIndex(selectIndex)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment