CNLiveMineEarnViewController.swift
4.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
//
// CNLiveMineEarnViewController.swift
// metaCode
//
// Created by open on 2023/6/28.
//
import Foundation
import JXSegmentedView
import JXPagingView
let kCNLiveSectionTitleHeight = 70//标题显示
let kCNLiveSectionHeaderHeight = 200//头视图高度
extension JXPagingListContainerView: JXSegmentedViewListContainer {}
class CNLiveMineEarnViewController: CNLiveBaseViewController, JXPagingViewDelegate {
func tableHeaderViewHeight(in pagingView: JXPagingView) -> Int {
return Int(kCNLiveSectionHeaderHeight)
}
func tableHeaderView(in pagingView: JXPagingView) -> UIView {
return headerView
}
func heightForPinSectionHeader(in pagingView: JXPagingView) -> Int {
return Int(kCNLiveSectionTitleHeight)
}
func viewForPinSectionHeader(in pagingView: JXPagingView) -> UIView {
return categoryView
}
func numberOfLists(in pagingView: JXPagingView) -> Int {
return 2
}
func pagingView(_ pagingView: JXPagingView, initListAtIndex index: Int) -> JXPagingViewListViewDelegate {
return (viewControllers.object(at: index) as! JXPagingViewListViewDelegate)
}
lazy var viewControllers: NSMutableArray = {
let viewControllers = NSMutableArray.init()
viewControllers.add(CNLiveMineEarnListViewController.init(show_type: .record))
viewControllers.add(CNLiveMineEarnListViewController.init(show_type: .balance))
return viewControllers
}()
lazy var dataSource: JXSegmentedTitleDataSource = {
let dataSource = JXSegmentedTitleDataSource()
dataSource.titles = ["积分记录","元码余额记录"]
dataSource.isTitleMaskEnabled = true
dataSource.itemWidth = (KSreenWidth - 105)/2
dataSource.itemSpacing = 0
dataSource.titleNormalFont = Font_16_Fit
dataSource.titleSelectedFont = Font_16_Fit
dataSource.titleNormalColor = HexColor("#999999")!
dataSource.titleSelectedColor = HexColor("#333333")!
return dataSource
}()
lazy var pagingView: JXPagingView = {
let pagingView = JXPagingView.init(delegate: self, listContainerType: .scrollView)
pagingView.frame = CGRectMake(0, KNavigationHeight, KSreenWidth, KSreenHeight - get_system_nav_height() - get_system_tabbar_ui_offsetHeight())
pagingView.backgroundColor = .clear
pagingView.mainTableView.backgroundColor = .clear
pagingView.pinSectionHeaderVerticalOffset = 0
pagingView.automaticallyDisplayListVerticalScrollIndicator = false
pagingView.listContainerView.isCategoryNestPagingEnabled = true
pagingView.listContainerView.scrollView.panGestureRecognizer.require(toFail: (self.navigationController?.interactivePopGestureRecognizer)!)
pagingView.mainTableView.panGestureRecognizer.require(toFail: (self.navigationController?.interactivePopGestureRecognizer)!)
categoryView.listContainer = pagingView.listContainerView
return pagingView
}()
lazy var categoryView: JXSegmentedView = {
let categoryView = JXSegmentedView.init(frame: CGRectMake(20, KNavigationHeight, KSreenWidth - 40, CGFloat(kCNLiveSectionTitleHeight)))
categoryView.dataSource = dataSource
categoryView.collectionView.backgroundColor = .clear
categoryView.backgroundColor = .clear
let lineView = JXSegmentedIndicatorBackgroundView.init()
lineView.indicatorColor = .white
lineView.indicatorHeight = 40
lineView.indicatorWidthIncrement = 0
lineView.indicatorCornerRadius = 5
categoryView.indicators = [lineView]
let radiusView = UIView(frame: CGRect(x: 20, y: 0, width: Int(KSreenWidth) - 40, height: kCNLiveSectionTitleHeight))
radiusView.backgroundColor = .clear
radiusView.addCorner(conrners: [.topLeft,.topRight], radius: 10)
radiusView.layer.borderColor = UIColor.white.cgColor
radiusView.layer.borderWidth = 10
categoryView.insertSubview(radiusView, belowSubview: categoryView.collectionView)
return categoryView
}()
lazy var headerView: MineEarnHeaderView = {
let headerView = MineEarnHeaderView.init(frame: CGRectMake(0, 0, KSreenWidth, CGFloat(kCNLiveSectionHeaderHeight)))
headerView.backgroundColor = .clear
return headerView
}()
var _index : Int!
init(index: Int) {
super.init(nibName: nil, bundle: nil)
_index = index
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
categoryView.selectItemAt(index: _index)
}
override func viewDidLoad() {
super.viewDidLoad()
navigationBarHidden = false
titleName = "我的收益"
view.addSubview(pagingView)
pagingView.listContainerView.didClickSelectedItem(at: _index)
}
}