OOTaskPageParameters.swift 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //
  2. // OOTaskPageParameters.swift
  3. // o2app
  4. //
  5. // Created by 刘振兴 on 2018/3/7.
  6. // Copyright © 2018年 zone. All rights reserved.
  7. //
  8. import Foundation
  9. class OOTaskPageParameter: NSObject {
  10. var pageParameter:O2TaskPageParameter?
  11. override init() {
  12. super.init()
  13. pageParameter = O2TaskPageParameter()
  14. }
  15. }
  16. class O2TaskPageParameter {
  17. var currentPageId:String = "(0)"
  18. //当前页
  19. var currentPageNo:Int = 1
  20. //每页行数
  21. let countByPage:Int = 20
  22. //总页数
  23. private var totalPageCount = 1
  24. //总行数
  25. var totalLineCount:Int = -1 {
  26. didSet {
  27. if totalLineCount > 0 && totalLineCount > countByPage * currentPageNo {
  28. //总页数
  29. totalPageCount = Int(ceil(Double(totalLineCount) / Double(countByPage)))
  30. }
  31. }
  32. }
  33. init() {
  34. }
  35. func calcNextPageNo() -> Bool {
  36. if currentPageNo < totalPageCount {
  37. currentPageNo += 1
  38. return true
  39. }else{
  40. return false
  41. }
  42. }
  43. }