ZLAppCollectionModel.swift 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //
  2. // ZLAppCollectionModel.swift
  3. // O2Platform
  4. //
  5. // Created by 刘振兴 on 2017/3/6.
  6. // Copyright © 2017年 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. class ZLAppCollectionModel: NSObject {
  10. //APP实例数组
  11. fileprivate var apps:[O2App] {
  12. get {
  13. let app1 = O2App(title: "云盘", appId:"", storyBoard: "file", vcName: nil, segueIdentifier: "showFileCloudSegue", normalIcon: "", selectedIcon: "", order: 0, mainOrder: 0)
  14. let app2 = O2App(title: "会议管理", appId:"", storyBoard: "meeting", vcName: nil, segueIdentifier: "showMeetingSegue", normalIcon: "", selectedIcon: "", order: 0, mainOrder: 0)
  15. let app3 = O2App(title: "考勤管理", appId:"", storyBoard: "ic", vcName: nil, segueIdentifier: "showIcSegue", normalIcon: "", selectedIcon: "", order: 0, mainOrder: 0)
  16. let app4 = O2App(title: "BBS", appId:"", storyBoard: "bbs", vcName: nil, segueIdentifier: "showBBSSegue", normalIcon: "", selectedIcon: "", order: 0, mainOrder: 0)
  17. let app5 = O2App(title: "内容管理", appId:"", storyBoard: "cms", vcName: nil, segueIdentifier: "showCMSSegue", normalIcon: "", selectedIcon: "", order: 0, mainOrder: 0)
  18. let app6 = O2App(title: "待办", appId:"", storyBoard: "task", vcName: "todoTask", segueIdentifier: nil, normalIcon: "", selectedIcon: "", order: 0, mainOrder: 0)
  19. let app7 = O2App(title: "待阅", appId:"", storyBoard: "task", vcName: "todoTask", segueIdentifier: nil, normalIcon: "", selectedIcon: "", order: 0, mainOrder: 0)
  20. let app8 = O2App(title: "语音助手", appId: "", storyBoard: "file", vcName: nil, segueIdentifier: "showFileCloudSegue", normalIcon: "", selectedIcon: "", order: 0, mainOrder: 0)
  21. let app9 = O2App(title: "日程安排", appId: "", storyBoard: "calendar", vcName: nil, segueIdentifier: "", normalIcon: "", selectedIcon: "", order: 0, mainOrder: 0)
  22. return [app1,app2,app3,app4,app5,app6,app7, app8, app9]
  23. }
  24. }
  25. /// Item最小的尺寸
  26. private static let MIN_ITEM_SIZE = 80.0
  27. /// Item实际尺寸存储值
  28. private var itemSize = ZLAppCollectionModel.MIN_ITEM_SIZE
  29. /// 每行Item数量
  30. var itemNumberByLine:Int = 0 {
  31. willSet {
  32. if newValue > apps.count {
  33. itemNumberByLine = apps.count
  34. }else{
  35. itemNumberByLine = newValue
  36. }
  37. }
  38. didSet {
  39. ///设置实际大小
  40. itemRectSize = max(ZLAppCollectionModel.MIN_ITEM_SIZE,Double(SCREEN_WIDTH)/Double(itemNumberByLine))
  41. }
  42. }
  43. /// Item实际大小
  44. var itemRectSize:Double = 0.0
  45. /// 根据宽度对齐后的总的item数量
  46. var appTotalItemNumber:Int {
  47. return 0
  48. }
  49. /// 总行数
  50. var totalLineNumber:Int {
  51. return 0
  52. }
  53. required override init() {
  54. super.init()
  55. }
  56. }