CNLiveHomePageDigitalRMBViewController.m
5.09 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
//
// CNLiveHomePageDigitalRMBViewController.m
// CNLiveDigitalRMBHomeDeom
//
// Created by daojian on 2023/4/26.
//
#import "CNLiveHomePageDigitalRMBViewController.h"
#import "NewPagedFlowView.h"
#import "CNLiveDigitalRMBHelp.h"
#import<CNLiveCommonCategory/UIColor+CNLiveExtension.h>
#import<YYCategories/YYCategories.h>
#define Width [UIScreen mainScreen].bounds.size.width
#define Height [UIScreen mainScreen].bounds.size.height
@interface CNLiveHomePageDigitalRMBViewController ()
/**
* 图片数组
*/
@property (nonatomic, strong) NSMutableArray *dataArray;
@property (nonatomic, strong) NewPagedFlowView *pageFlowView;
@end
@implementation CNLiveHomePageDigitalRMBViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
for (int index = 0; index < 2; index++) {
[self.dataArray addObject:@""];
}
[self setupUI];
// let maskPath = UIBezierPath.init(roundedRect: box, byRoundingCorners: [.topRight,.topLeft], cornerRadii: CGSizeMake(width: 6.0, height: 6.0))
//
// let maskLayer = CAShapeLayer()
//
// maskLayer.frame = self.bgView.bounds
//
// maskLayer.path = maskPath.cgPath
//
// self.bgView.layer.mask = maskLayer
// CGFloat W = Width-100;
// UIView *topView = [[UIView alloc] initWithFrame:CGRectMake(50, 0, W,W/2)];
// topView.backgroundColor = [UIColor clearColor];
// [self.view addSubview:topView];
//
// //画半圆
// UIBezierPath *circle = [UIBezierPath bezierPathWithArcCenter:CGPointMake(W/2, 0) radius:W/2 startAngle:0 endAngle:M_PI clockwise:YES];
// CAShapeLayer *shapeLayer = [[CAShapeLayer alloc] init];
// shapeLayer.path = circle.CGPath;
// shapeLayer.fillColor = [UIColor greenColor].CGColor;
// [topView.layer addSublayer:shapeLayer];
//
// UIView *bottomView = [[UIView alloc] initWithFrame:CGRectMake(50, Height -W/2 , W,W/2)];
// bottomView.backgroundColor = [UIColor clearColor];
// [self.view addSubview:bottomView];
//
// UIBezierPath *bottomCircle = [UIBezierPath bezierPathWithArcCenter:CGPointMake(W/2, W/2) radius:W/2 startAngle:0 endAngle:M_PI clockwise:NO];
// CAShapeLayer *bottomShapeLayer = [[CAShapeLayer alloc] init];
// bottomShapeLayer.path = bottomCircle.CGPath;
// bottomShapeLayer.fillColor = [UIColor greenColor].CGColor;
// [bottomView.layer addSublayer:bottomShapeLayer];
//
// UILabel *laber =[[UILabel alloc] initWithFrame:CGRectMake(100, 50, 100, 20)];
// laber.text = @"付钱";
// laber.textAlignment = NSTextAlignmentCenter;
// [bottomView addSubview:laber];
}
#pragma mark --push控制器
- (void)pushCustomVC {
}
- (void)setupUI {
self.automaticallyAdjustsScrollViewInsets = NO;
// NewPagedFlowView *pageFlowView = [[NewPagedFlowView alloc] initWithFrame:CGRectMake(0, 72, Width, Width * 9 / 16)];
NewPagedFlowView *pageFlowView = [[NewPagedFlowView alloc] initWithFrame:CGRectMake(0, 0, Width, Height)];
pageFlowView.delegate = self;
pageFlowView.dataSource = self;
pageFlowView.minimumPageAlpha = 0.1;
pageFlowView.isCarousel = NO;
pageFlowView.orientation = NewPagedFlowViewOrientationHorizontal;
pageFlowView.leftRightMargin = 20;
pageFlowView.isOpenAutoScroll = YES;
//左右图片的距离顶部和底部的高度
pageFlowView.topBottomMargin = 0;
[pageFlowView reloadData];
self.pageFlowView = pageFlowView;
[self.view addSubview:pageFlowView];
}
#pragma mark NewPagedFlowView Delegate
- (void)didSelectCell:(UIView *)subView withSubViewIndex:(NSInteger)subIndex {
NSLog(@"点击了第%ld张图",(long)subIndex + 1);
}
- (void)didScrollToPage:(NSInteger)pageNumber inFlowView:(NewPagedFlowView *)flowView {
NSLog(@"ViewController 滚动到了第%ld页",pageNumber);
}
#pragma mark NewPagedFlowView Datasource
- (NSInteger)numberOfPagesInFlowView:(NewPagedFlowView *)flowView {
return self.dataArray.count;
}
- (PGIndexBannerSubiew *)flowView:(NewPagedFlowView *)flowView cellForPageAtIndex:(NSInteger)index{
PGIndexBannerSubiew *bannerView = [flowView dequeueReusableCell];
if (!bannerView) {
bannerView = [[PGIndexBannerSubiew alloc] initWithFrame:CGRectMake(0, 0, Width-50, Height)];
bannerView.tag = index + 100;
bannerView.layer.cornerRadius = 4;
bannerView.layer.masksToBounds = NO;
}
bannerView.superScrollView = flowView.scrollView;
bannerView.associatedVCView = self.view;
return bannerView;
}
- (CGSize)sizeForPageInFlowView:(NewPagedFlowView *)flowView {
return CGSizeMake(Width-50,Height);
}
#pragma mark --懒加载
- (NSMutableArray *)dataArray {
if (_dataArray == nil) {
_dataArray = [NSMutableArray array];
}
return _dataArray;
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end