Commit 78b769f8 authored by CZ1004's avatar CZ1004

优化

parent 77c59570
......@@ -13,6 +13,8 @@ class HomeInfoView :UIView {
var titleText : String?
var isDragEnd : Bool = false
var type : PhotsFileType?
var models:[HomeInfoTableItem] = []
......@@ -315,6 +317,7 @@ class HomeInfoView :UIView {
extension HomeInfoView:UITableViewDataSource,UITableViewDelegate {
@objc func nextRowButtonAction(){
self.tableScrollToNextRow()
}
......@@ -351,7 +354,7 @@ extension HomeInfoView:UITableViewDataSource,UITableViewDelegate {
guard let indexPath = tableView.indexPathsForVisibleRows?.first else { return }
let nextRow = indexPath.row + 1
let nextRow = self.isDragEnd == true ? indexPath.row + 1 : indexPath.row + 2
let nextSection = indexPath.section
// 检查下一行是否存在
......@@ -370,6 +373,7 @@ extension HomeInfoView:UITableViewDataSource,UITableViewDelegate {
// 直接滚动到调整后的位置
tableView.setContentOffset(adjustedOffset, animated: true)
self.isDragEnd = false
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
......@@ -386,6 +390,10 @@ extension HomeInfoView:UITableViewDataSource,UITableViewDelegate {
tableView.bringSubviewToFront(self.headerView)
}
func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
self.isDragEnd = true
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return models.count
......
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