| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- //
- // GuiZuViewController.m
- // BuguLive
- //
- // Created by bugu on 2019/12/2.
- // Copyright © 2019 xfg. All rights reserved.
- //
- #import "GuiZuViewController.h"
- #import "GuiZuView.h"
- #import "GuiZuBottomView.h"
- @interface GuiZuViewController ()
- @property(nonatomic, strong) NSMutableArray *dataArray;
- @property(nonatomic, strong) UIScrollView *mainScrollView;
- @property(nonatomic, strong) UIScrollView *titleScrollView;
- @property(nonatomic, strong) UIView *titlesView;
- @property(nonatomic, assign) NSInteger type;
- @property(nonatomic, strong) GuiZuView *guiZuView;
- @property(nonatomic, strong) GuiZuBottomView *bottomView;
- @end
- @implementation GuiZuViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self backBtnWithBlock];
- // Do any additional setup after loading the view.
- }
- - (void)backBtnWithBlock
- {
- // 返回按钮
- [self setupBackBtnWithBlock:nil];
- }
- - (void)initFWUI{
- [super initFWUI];
- [self.view addSubview:self.mainScrollView];
-
- [self.view addSubview:self.bottomView];
- [self.mainScrollView addSubview:self.guiZuView];
-
- [self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.mas_equalTo(0);
- make.bottom.mas_equalTo(isIPhoneX()?-34 :0);
- make.height.mas_equalTo(70);
- }];
- self.guiZuView.frame = CGRectMake(0, 0, kScreenW, kRealValue(550));
-
- [self.mainScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.top.right.mas_equalTo(0);
- make.bottom.equalTo(self.bottomView.mas_top).offset(-20);
- }];
- [self.view addSubview:self.titlesView];
-
- }
- -(void)initFWData
- {
- [super initFWData];
-
- [self.bottomView setDataWithGift:@"333" money:@"3" day:@"33"];
-
- }
- #pragma mark 主页和直播的点击事件
- - (void)HLBtnClick:(UIButton *)btn
- {
- [self updateUIWithTag:(int)btn.tag];
- }
- - (void)updateUIWithTag:(int)tag
- {
- for (UIButton *newBtn in self.titlesView.subviews)
- {
- if ([newBtn isKindOfClass:[UIButton class]])
- {
- if (newBtn.tag ==tag)
- {
- [newBtn setTitleColor:[UIColor colorWithHexString:@"#FFEF77"] forState:UIControlStateNormal];
- newBtn.titleLabel.font = [UIFont boldSystemFontOfSize:16];
- }else
- {
- [newBtn setTitleColor:[UIColor colorWithHexString:@"#E5E5E5"] forState:UIControlStateNormal];
- newBtn.titleLabel.font = [UIFont systemFontOfSize:14];
- }
-
- }
- }
-
- //页面刷新
- // [_myScrollView scrollRectToVisible:CGRectMake(tag * kScreenW, 0, kScreenW, CGRectGetHeight(_myScrollView.frame)) animated:YES];
- }
- #pragma mark - setter
- - (NSMutableArray *)dataArray{
- if (!_dataArray) {
- _dataArray = [NSMutableArray array];
- }
- return _dataArray;
- }
- - (UIScrollView *)mainScrollView{
- if (!_mainScrollView) {
- _mainScrollView = ({
- UIScrollView * scrollView = [[UIScrollView alloc]init];
- // scrollView.contentSize = CGSizeMake(kScreenW, kScreenH);
-
-
- scrollView;
- });
- }
- return _mainScrollView;
- }
- - (GuiZuView *)guiZuView{
- if (!_guiZuView) {
- _guiZuView = [[GuiZuView alloc]init];;
-
- }
- return _guiZuView;
- }
- - (GuiZuBottomView *)bottomView{
- if (!_bottomView) {
- _bottomView = [[GuiZuBottomView alloc]init];
- }
- return _bottomView;
- }
- - (UIView *)titlesView{
- if (!_titlesView) {
- _titlesView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, 45*kAppRowHScale)];
- _titlesView.backgroundColor = [UIColor clearColor];
- NSArray *nameArray = @[ASLocalizedString(@"玄铁"),ASLocalizedString(@"青铜"),ASLocalizedString(@"白银"),ASLocalizedString(@"黄金"),ASLocalizedString(@"铂金"),ASLocalizedString(@"钻石"),ASLocalizedString(@"星耀"),ASLocalizedString(@"王者")];
- CGFloat btnWidth = kScreenW/nameArray.count;
- for (int i = 0; i < nameArray.count; i ++)
- {
- UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
- button.frame = CGRectMake(btnWidth*i ,0,btnWidth, 49);
- [button setTitle:nameArray[i] forState:0];
- button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
- if (self.type == i)
- {
- [button setTitleColor:[UIColor colorWithHexString:@"#FFEF77"] forState:UIControlStateNormal];
- button.titleLabel.font = [UIFont boldSystemFontOfSize:16];
- }else
- {
- [button setTitleColor:[UIColor colorWithHexString:@"#E5E5E5"] forState:UIControlStateNormal];
- button.titleLabel.font = [UIFont systemFontOfSize:14];
- }
- button.tag = i;
- [button addTarget:self action:@selector(HLBtnClick:) forControlEvents:UIControlEventTouchUpInside];
- [_titlesView addSubview:button];
- }
- }
- return _titlesView;
- }
- @end
|