123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578 |
- //
- // JXVIPDetailViewController.m
- // shiku_im
- //
- // Created by cindy on 2020/5/29.
- // Copyright © 2020 Reese. All rights reserved.
- //
- #import "JXVIPDetailVc.h"
- #import "XFStepView.h"
- #import "JXVipCenterView.h"
- #import "JXMyModel.h"
- #import "JXVipDetailTopView.h"
- @interface JXVIPDetailVc ()<UIScrollViewDelegate>
- @property (nonatomic, strong) UIScrollView *mainScrollView;
- @property (strong, nonatomic)UIImageView *topImageView;//顶部背景图
- @property (nonatomic,strong) UIImageView *vipGradeBigImageView; //顶部右边最大的等级图
- @property (nonatomic,strong) UILabel *vipNumberLabelForBigVIPGradeImageView;
- @property (nonatomic,strong) UILabel *vipNumberLabelForvipImageView;
- @property (nonatomic,strong) UIImageView *headerImageView;
- @property (nonatomic,strong) UILabel *nameLabel;//昵称
- @property (nonatomic,strong) UIButton *leftVipGradeLabel;
- @property (nonatomic,strong) UIButton *rightVipGradeLabel;
- @property (nonatomic,strong) UILabel *progressLabel; //进度Label
- @property (nonatomic,strong)UIView *oneDianView;
- @property (nonatomic,strong)UIImageView *progressImageView;
- @property (nonatomic,strong)UIImageView *progressImageView2;
- @property (nonatomic,strong)UIImageView *progressImageView3;
- @property (nonatomic,strong)UIImageView *sanjiaoxingView;
- @property (nonatomic,strong) UILabel *currentLabel;
- @property (nonatomic,strong)UILabel *currentCompanyLabel;
- @property (nonatomic,strong)UIView *twoDianView;
- @property (nonatomic,strong) UILabel *currentPriceLabel; //当前存款数
- @property (nonatomic,strong) UILabel *differencePriceLabel; //升级还差的数
- @property (nonatomic,strong) UILabel *differenceLabel;
- @property (nonatomic,strong)UILabel *differenceCompanyLabel;
- @property (strong, nonatomic)UIView *centerView;
- @property (strong, nonatomic)XFStepView *stepView; //等级进度UI
- @property (strong, nonatomic)UIScrollView *grapeScrollView;//等级进度UI的ScrollView
- @property (strong, nonatomic)UILabel *currentPageLabel;//当前显示的图片数
- @property (strong, nonatomic)UIScrollView *centerScrollView;
- @property (strong, nonatomic)UIView *bottomView;
- @property (strong, nonatomic)UIButton *button;
- @property (strong, nonatomic)UILabel *zunxiangLabel;//尊享Label
- @property (strong, nonatomic)UIImageView *buttonIconImageView;;
- @property (strong, nonatomic)UILabel *buttonTitleLabel;
- @property (strong, nonatomic)UILabel *buttonDetailLabel;
- @property (nonatomic,strong) NSMutableArray *dataArr;
- @property (nonatomic,strong) UIImageView *vipGradeImageView;
- @property (nonatomic,assign) int page;
- @property (nonatomic,strong) JXVipDetailTopView *topView;
- @end
- @implementation JXVIPDetailVc
- - (void)viewWillAppear:(BOOL)animated{
- [super viewWillAppear:animated];
- [self.navigationController setNavigationBarHidden:NO];
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- _dataArr=[NSMutableArray array];
- //自定义导航栏
- [self _createdNavigationBar];
-
- //创建View
- [self _createdViews];
- }
- //自定义导航栏
- - (void)_createdNavigationBar {
- self.navigationItem.title=@"VIP特权";
-
- long time = (long)[[NSDate date] timeIntervalSince1970];
- time = (time *1000 + g_server.timeDifference);
- NSString *salt = [NSString stringWithFormat:@"%ld", time];
- ///user/vip/info /user/vip/info
- [g_server getact_act_userGradelistGrade:salt andToView:self];
- [SVProgressHUD show];
- [g_server getUserVipInformation:salt andToView:self];
-
-
- [g_server getUseract_userGradelistGrade:salt andToView:self];
-
- }
- #pragma mark --- 请求成功
- -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{
-
- // NSLog(@"dict: %@ --- arry: %@",dict ,array1 );
- if([aDownload.action isEqualToString:act_userGradelistGrade]){
-
-
- _dataArr=[vipDetailModel mj_objectArrayWithKeyValuesArray:array1];
- // NSArray *smallArray = [_dataArr subarrayWithRange:NSMakeRange(0, 10)];
-
- // _dataArr=[smallArray mutableCopy];
- [self _createdCenterView:_dataArr];
-
-
- }
-
- if([aDownload.action isEqualToString:act_userViplist]){
- // _dataArr=[vipDetailModel mj_objectArrayWithKeyValuesArray:array1];
- // NSArray *smallArray = [_dataArr subarrayWithRange:NSMakeRange(0, 10)];
- //
- // _dataArr=[smallArray mutableCopy];
- // [self _createdCenterView:_dataArr];
- //
- // [self _createdBottomView];
-
- }if([aDownload.action isEqualToString:act_GetUserVipInformation]){
- [SVProgressHUD dismiss];
-
- self.topView.dictInfo=dict;
-
- //当前等级
- NSString *ss = [NSString stringWithFormat:@"%@",dict[@"current"][@"level"]];
- int c = [ss intValue];
- self.currentPageLabel.text = [NSString stringWithFormat:@"%d",c];
- self.centerScrollView.contentOffset = CGPointMake(self.centerScrollView.width*(c), 0);
-
- self.zunxiangLabel.text = [NSString stringWithFormat:@"VIP%d尊享",c];
-
- for (int i=0; i<_dataArr.count; i++) {
- if (i == c) {
- vipDetailModel *model = _dataArr[c];
- self.vipNumberLabelForvipImageView.text =[NSString stringWithFormat:@"%@",model.level];
-
- UIImageView *imageView = (UIImageView *)[_centerView viewWithTag:200+(c)];
- UILabel *label1 = (UILabel *)[imageView viewWithTag:1000+(c)];
- label1.text = [NSString stringWithFormat:@"VIP%@",model.level];
- UILabel *label2 = (UILabel *)[imageView viewWithTag:10000+(c)];
- label2.text = [NSString stringWithFormat:@"%@",model.money];
-
- UIButton *but = (UIButton *)[self.bottomView viewWithTag:10];
- UIButton *but2 = (UIButton *)[self.bottomView viewWithTag:10+2];
- UILabel *titleLabel = (UILabel *)[but viewWithTag:200];
- UILabel *titleLabel2 = (UILabel *)[but2 viewWithTag:200+c];
- titleLabel.text = model.money;
- titleLabel2.text = model.upgradeCoin;
- }
- }
- // [self.mainScrollView reloadInputViews];
-
- }
-
- }
- -(CGSize)titleBtnWight:(NSString *)titBtnW and:(UILabel *)titBtn {
- CGSize titleSize = [titBtnW boundingRectWithSize:CGSizeMake(MAXFLOAT, 17) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:titBtn.font} context:nil].size;
-
- return titleSize;
- }
- -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{
- [SVProgressHUD dismiss];
- NSString * errorCode = [NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]];
- if([errorCode isEqualToString:@"权限验证失败"])
- {
- if ([aDownload.action isEqualToString:act_userViplist])
- {
-
- }if([aDownload.action isEqualToString:actuservipinfo]){
-
- }
- }
-
- return [errorCode intValue];
- }
- - (void)goback{
- [g_navigation dismissViewController:self animated:NO];
- }
- - (void)_createdViews {
-
- _dataArr=[NSMutableArray array];
-
- //顶部UI
- [self _createdTopView];
-
- }
- - (void)gobackxx{
-
- [g_navigation dismissViewController:self animated:YES];
- }
- - (void)_createdTopView {
-
-
-
- JXVipDetailTopView *topView=[JXVipDetailTopView XIBJXVipDetailTopView];
- topView.frame=CGRectMake(0, 0, JX_SCREEN_WIDTH, 260);
- self.topView=topView;
- [self.mainScrollView addSubview:topView];
- [topView.gobackBt addTarget:self action:@selector(gobackxx) forControlEvents:UIControlEventTouchUpInside];
-
- return;
- //顶部图。V1
- self.topImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 250)];
- self.topImageView.image=[UIImage imageNamed:@"bgVip02"];
- [self.mainScrollView addSubview:self.topImageView];
-
- //最右边VIP等级big图
- UIImageView *vipGradeBigImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.topImageView.width-100, 0, 65, 85)];
- vipGradeBigImageView.image = [UIImage imageNamed:@"组54"];
- [self.topImageView addSubview:vipGradeBigImageView];
-
- UILabel *vip = [[UILabel alloc] initWithFrame:CGRectMake(0, 40, vipGradeBigImageView.width, 15)];
- vip.text = @"VIP";
- vip.textColor = [UIColor brownColor];
- vip.textAlignment = NSTextAlignmentCenter;
- vip.font = kBoldFont(8);
- [vipGradeBigImageView addSubview:vip];
-
- self.vipNumberLabelForBigVIPGradeImageView = [[UILabel alloc] initWithFrame:CGRectMake(0, vip.bottom, vipGradeBigImageView.width, 15)];
- self.vipNumberLabelForBigVIPGradeImageView.text = @"0";
- self.vipNumberLabelForBigVIPGradeImageView.textColor = [UIColor brownColor];
- self.vipNumberLabelForBigVIPGradeImageView.textAlignment = NSTextAlignmentCenter;
- self.vipNumberLabelForBigVIPGradeImageView.font = kBoldFont(20);
- [vipGradeBigImageView addSubview:self.vipNumberLabelForBigVIPGradeImageView];
-
- //头像
- self.headerImageView = [[UIImageView alloc] initWithFrame:CGRectMake(15, 15, 70, 70)];
- self.headerImageView.layer.cornerRadius= 35;
- self.headerImageView.layer.masksToBounds = YES;
- [self.topImageView addSubview:self.headerImageView];
-
- [g_server delHeadImage:g_server.myself.userId];
- [g_server getHeadImageSmall:g_server.myself.userId userName:g_server.myself.userNickname imageView:self.headerImageView];
-
- //昵称
- self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.headerImageView.right+15, 30, 100, 25)];
- self.nameLabel.text = @"唐小七";
- self.nameLabel.textColor = [UIColor blackColor];
- self.nameLabel.textAlignment = NSTextAlignmentLeft;
- self.nameLabel.font = [UIFont boldSystemFontOfSize:17];
- [self.topImageView addSubview:self.nameLabel];
-
- //vip等级
- self.vipGradeImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.nameLabel.right+5, 34, 50, 17)];
- self.vipGradeImageView.image = [UIImage imageNamed:@"组38"];
- //self.vipGradeImageView.backgroundColor = [UIColor yellowColor];
- [self.topImageView addSubview:self.vipGradeImageView];
-
- self.leftVipGradeLabel = [[UIButton alloc] initWithFrame:CGRectMake(35, self.headerImageView.bottom+40, 60, 30)];
- // self.leftVipGradeLabel .backgroundColor = [UIColor brownColor];
- self.leftVipGradeLabel .layer.cornerRadius = 10;
- self.leftVipGradeLabel .layer.masksToBounds = YES;
- self.leftVipGradeLabel.imageView.contentMode = UIViewContentModeScaleAspectFill;
- //[self.leftVipGradeLabel setTitle:@"VIP0" forState:UIControlStateNormal];
- self.leftVipGradeLabel.titleLabel.font = [UIFont systemFontOfSize:13];
- [self.topImageView addSubview:self.leftVipGradeLabel ];
-
- self.rightVipGradeLabel = [[UIButton alloc] initWithFrame:CGRectMake(self.topImageView.width-80, self.headerImageView.bottom+40, 60, 30)];
- //self.rightVipGradeLabel.backgroundColor = [UIColor lightGrayColor];
- self.rightVipGradeLabel.layer.cornerRadius = 10;
- self.rightVipGradeLabel.layer.masksToBounds = YES;
- self.rightVipGradeLabel.imageView.contentMode = UIViewContentModeScaleAspectFill; //[self.leftVipGradeLabel setTitle:@"VIP1" forState:UIControlStateNormal];
- self.rightVipGradeLabel.titleLabel.font = [UIFont systemFontOfSize:13];
- [self.topImageView addSubview:self.rightVipGradeLabel];
-
- self.progressImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.leftVipGradeLabel.right+10, self.headerImageView.bottom+45, self.topImageView.width-90-90, 20)];
- // self.progressImageView.backgroundColor = [UIColor blueColor];
- // self.progressImageView.layer.cornerRadius=7;
- self.progressImageView.image = [UIImage imageNamed:@"my_progress"];
- self.progressImageView.contentMode = UIViewContentModeScaleToFill;
- [self.topImageView addSubview:self.progressImageView];
-
- self.progressImageView2 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 0, 20)];
- self.progressImageView2.layer.cornerRadius=7;
- self.progressImageView2.backgroundColor = kRGBColor(222, 186, 152);
- [self.progressImageView addSubview:self.progressImageView2];
-
- self.progressImageView3 = [[UIImageView alloc] initWithFrame:CGRectMake(self.leftVipGradeLabel.right+10, self.headerImageView.bottom+39, 42 , 32)];
- self.progressImageView3.image = [UIImage imageNamed:@"组37"];
- [self.topImageView addSubview:self.progressImageView3];
-
-
- self.progressLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.leftVipGradeLabel.right+self.progressImageView2.width, self.headerImageView.bottom+15, 50, 20)];
- self.progressLabel.text = @"2%";
- self.progressLabel.textColor = [UIColor blackColor];
- self.progressLabel.textAlignment = NSTextAlignmentLeft;
- self.progressLabel.font = [UIFont systemFontOfSize:13];
- [self.topImageView addSubview:self.progressLabel];
-
- self.sanjiaoxingView = [[UIImageView alloc] initWithFrame:CGRectMake(self.leftVipGradeLabel.right+self.progressImageView2.width, self.progressLabel.bottom, 15, 10)];
- self.sanjiaoxingView.image = [UIImage imageNamed:@"组38"];
- // self.sanjiaoxingView.backgroundColor = [UIColor redColor];
- [self.topImageView addSubview:self.sanjiaoxingView];
-
- //当前累计存款
- self.oneDianView = [[UIView alloc] initWithFrame:CGRectMake(35, self.headerImageView.bottom+100, 6, 6)];
- self.oneDianView.layer.cornerRadius = 3;
- self.oneDianView.layer.masksToBounds = YES;
- self.oneDianView.backgroundColor = [UIColor grayColor];
- [self.topImageView addSubview:self.oneDianView];
-
- self.currentLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.oneDianView.right+3, self.headerImageView.bottom+96, 260, 15)];
- self.currentLabel.textAlignment = NSTextAlignmentLeft;
- self.currentLabel.textColor = [UIColor purpleColor];
- self.currentLabel.font = [UIFont systemFontOfSize:12];
- self.currentLabel.text = @"当前累计存款(元):";
- [self.topImageView addSubview:self.currentLabel];
-
- return;
- self.currentPriceLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.currentLabel.right+3, self.headerImageView.bottom+96, 100+5, 15)];
- self.currentPriceLabel.textAlignment = NSTextAlignmentLeft;
- self.currentPriceLabel.textColor = [UIColor blackColor];
- self.currentPriceLabel.font = [UIFont systemFontOfSize:12];
- self.currentPriceLabel.text = @"0.00";
- [self.topImageView addSubview:self.currentPriceLabel];
-
- self.currentCompanyLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.currentPriceLabel.right+3, self.headerImageView.bottom+96, 100, 15)];
- self.currentCompanyLabel.textAlignment = NSTextAlignmentLeft;
- self.currentCompanyLabel.textColor = [UIColor purpleColor];
- self.currentCompanyLabel.font = [UIFont systemFontOfSize:12];
- self.currentCompanyLabel.text = @"(0.00/500)";
- [self.topImageView addSubview:self.currentCompanyLabel];
-
- //还差升级存款
- self.twoDianView = [[UIView alloc] initWithFrame:CGRectMake(35, self.currentLabel.bottom+14, 6, 6)];
- self.twoDianView.layer.cornerRadius = 3;
- self.twoDianView.layer.masksToBounds = YES;
- self.twoDianView.backgroundColor = [UIColor grayColor];
- [self.topImageView addSubview:self.twoDianView];
-
- self.differenceLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.twoDianView.right+3, self.currentLabel.bottom+10, 100, 15)];
- self.differenceLabel.textAlignment = NSTextAlignmentLeft;
- self.differenceLabel.textColor = [UIColor purpleColor];
- self.differenceLabel.font = [UIFont systemFontOfSize:12];
- self.differenceLabel.text = @"还差升级存款(元):";
- [self.topImageView addSubview:self.differenceLabel];
-
- self.differencePriceLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.differenceLabel.right+3, self.currentLabel.bottom+10, 100, 15)];
- self.differencePriceLabel.textAlignment = NSTextAlignmentLeft;
- self.differencePriceLabel.textColor = [UIColor blackColor];
- self.differencePriceLabel.font = [UIFont systemFontOfSize:12];
- self.differencePriceLabel.text = @"0.00";
- [self.topImageView addSubview:self.differencePriceLabel];
-
- self.differenceCompanyLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.differencePriceLabel.right+3, self.currentLabel.bottom+10, 100, 15)];
- self.differenceCompanyLabel.textAlignment = NSTextAlignmentLeft;
- self.differenceCompanyLabel.textColor = [UIColor purpleColor];
- self.differenceCompanyLabel.font = [UIFont systemFontOfSize:12];
- self.differenceCompanyLabel.text = @"(0.00/3,000)";
- [self.topImageView addSubview:self.differenceCompanyLabel];
-
-
- }
- - (void)_createdCenterView:(NSMutableArray *)array {
-
- self.centerView = [[UIView alloc] initWithFrame:CGRectMake(0, self.topView.bottom+20, kScreenWidth, 210)];
- [self.mainScrollView addSubview:self.centerView];
-
- //等级ScrollView
- self.grapeScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.centerView.width, 40)];
- self.grapeScrollView.contentSize = CGSizeMake(100*array.count, 40);
- self.grapeScrollView.bounces = NO;
- [self.centerView addSubview:self.grapeScrollView];
-
- //等级UI
- _stepView = [[XFStepView alloc]initWithFrame:CGRectMake(0, 0, 100*array.count, 40) Titles:array];
- [self.grapeScrollView addSubview:_stepView];
- self.centerScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(50, self.grapeScrollView.bottom+10, kScreenWidth-100, 120)];
- self.centerScrollView.delegate = self;
- self.centerView.clipsToBounds = NO;
- self.centerScrollView.clipsToBounds = NO;
- self.centerScrollView.pagingEnabled = YES;
- self.centerScrollView.bounces = NO;
- self.centerScrollView.showsHorizontalScrollIndicator = NO;
- self.centerScrollView.contentSize = CGSizeMake(self.centerScrollView.width*array.count, 120);
- [self.centerView addSubview:self.centerScrollView];
- //创建图片
- for(int i = 0; i <array.count;i++) {
- CGRect frame = self.centerScrollView.frame;
- vipDetailModel *model=array[i];
-
- UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(frame.size.width * i + 10, 0, self.centerScrollView.width-20, 120)];
- imageView.tag = 200+i;
- imageView.layer.cornerRadius = 12;
- imageView.layer.masksToBounds = YES;
- imageView.backgroundColor = RGBColor(207, 194, 200);
- [self.centerScrollView addSubview:imageView];
-
- UIImageView *vipImageView = [[UIImageView alloc] initWithFrame:CGRectMake(imageView.width-70, 0, 55, 80)];
- vipImageView.image = [UIImage imageNamed:@"组54"];
- [imageView addSubview:vipImageView];
-
- UILabel *vipLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 30, vipImageView.width, 15)];
- vipLabel.text = @"VIP";
- vipLabel.textColor = [UIColor brownColor];
- vipLabel.textAlignment = NSTextAlignmentCenter;
- vipLabel.font = kBoldFont(8);
- [vipImageView addSubview:vipLabel];
-
- self.vipNumberLabelForvipImageView = [[UILabel alloc] initWithFrame:CGRectMake(0, vipLabel.bottom, vipImageView.width, 15)];
- self.vipNumberLabelForvipImageView.text =[NSString stringWithFormat:@"%@",model.level];
- self.vipNumberLabelForvipImageView.textColor = [UIColor brownColor];
- self.vipNumberLabelForvipImageView.textAlignment = NSTextAlignmentCenter;
- self.vipNumberLabelForvipImageView.font = kBoldFont(20);
- [vipImageView addSubview:self.vipNumberLabelForvipImageView];
-
- UILabel *dengjiLabel = [[UILabel alloc] initWithFrame:CGRectMake(30, 30, 100, 20)];
- dengjiLabel.textColor = kWhiteColor;
- dengjiLabel.textAlignment = NSTextAlignmentLeft;
- dengjiLabel.font = kBoldFont(22);
- dengjiLabel.tag = 1000+i;
- dengjiLabel.text = [NSString stringWithFormat:@"VIP%@",model.level];
- [imageView addSubview:dengjiLabel];
-
- UILabel *leijiPriceLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, dengjiLabel.bottom+25, 90, 15)];
- leijiPriceLabel.textColor = kWhiteColor;
- leijiPriceLabel.textAlignment = NSTextAlignmentCenter;
- leijiPriceLabel.font = kFont(13);
- leijiPriceLabel.tag = 10000+i;
- leijiPriceLabel.text = [NSString stringWithFormat:@"%@",model.money];
- [imageView addSubview:leijiPriceLabel];
- UILabel *leijiLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, leijiPriceLabel.bottom+5, 90, 15)];
- leijiLabel.textColor = kWhiteColor;
- leijiLabel.textAlignment = NSTextAlignmentCenter;
- leijiLabel.font = kFont(13);
- leijiLabel.text = @"累计存款";
- [imageView addSubview:leijiLabel];
- }
-
- self.currentPageLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.centerView.width-90, self.centerScrollView.bottom+10, 30, 20)];
- self.currentPageLabel.text = @"1";
- self.currentPageLabel.textColor = [UIColor blackColor];
- self.currentPageLabel.textAlignment = NSTextAlignmentRight;
- self.currentPageLabel.font = [UIFont systemFontOfSize:14];
- [self.centerView addSubview:self.currentPageLabel];
- UILabel *totalPageLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.currentPageLabel.right, self.centerScrollView.bottom+10, 30, 20)];
- totalPageLabel.text = [NSString stringWithFormat:@"/%zd",_dataArr.count];
- totalPageLabel.textColor = [UIColor purpleColor];
- totalPageLabel.textAlignment = NSTextAlignmentLeft;
- totalPageLabel.font = [UIFont systemFontOfSize:14];
- [self.centerView addSubview:totalPageLabel];
- }
- - (void)_createdBottomView {
- self.bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, self.centerView.bottom+10, kScreenWidth, 200)];
- [self.mainScrollView addSubview:self.bottomView];
-
- // UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 2)];
- // lineView.backgroundColor = [UIColor grayColor];
- // [self.bottomView addSubview:lineView];
-
- UIView *lineTwoView = [[UIView alloc] initWithFrame:CGRectMake(0,0, kScreenWidth, 10)];
- lineTwoView.backgroundColor = kRGBColor(246, 246, 246);
- [self.bottomView addSubview:lineTwoView];
- lineTwoView.layer.shadowColor = kRGBColor(232, 232, 232).CGColor;//阴影颜色
- lineTwoView.layer.shadowOffset = CGSizeMake(0, 0);//偏移距离
- lineTwoView.layer.shadowOpacity = 0.5;//不透明度
- lineTwoView.layer.shadowRadius = 10.0;//半径
-
-
-
-
- UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(15, lineTwoView.bottom+15, 2, 20)];
- imgView.backgroundColor= [UIColor redColor];
- [self.bottomView addSubview:imgView];
-
- self.zunxiangLabel = [[UILabel alloc] initWithFrame:CGRectMake(imgView.right+5, 20, 130, 30)];
- self.zunxiangLabel.text = @"VIP1尊享";
- self.zunxiangLabel.textColor = [UIColor blackColor];
- self.zunxiangLabel.textAlignment = NSTextAlignmentLeft;
- self.zunxiangLabel.font = [UIFont boldSystemFontOfSize:22];
- [self.bottomView addSubview:self.zunxiangLabel];
-
- NSArray *imageArray = @[@"sjlj",@"ltkuang",@"meirhb",@"bqb"];
- NSArray *titleArray = @[
- @"500",@"聊天框",@"1",@"表情包"];
- NSArray *detailArray = @[
- @"升级礼金(晋级自动发放)",@"1(我—设置里更改)",@"每日红包(每天结算)",@"1(V6以上解锁第二套)",];
-
- int xLeft = 0;
- int yleft = imgView.bottom;
- CGFloat buttonWidth = (kScreenWidth-30)/2;
- for (int i=0; i<imageArray.count; i++) {
- NSString *title = titleArray[i];
- NSString *detai = detailArray[i];
-
- _button = [UIButton buttonWithType:UIButtonTypeCustom];
- if (xLeft +buttonWidth > kScreenWidth){
- xLeft = 0;
- yleft = yleft+10+50;
- }
- _button.frame = CGRectMake(xLeft + 10, yleft + 10, buttonWidth, 50);
- _button.tag = 10+i;
- [self.bottomView addSubview:_button];
-
- self.buttonIconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(15, 0, 25, 40)];
- self.buttonIconImageView.image = [UIImage imageNamed:imageArray[i]];
- self.buttonIconImageView.contentMode=UIViewContentModeScaleAspectFit;
- self.buttonIconImageView.tag = 100+i;
- [_button addSubview:self.buttonIconImageView];
-
- self.buttonTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.buttonIconImageView.right+10, 0, _button.width-(self.buttonIconImageView.right+10), 20)];
- self.buttonTitleLabel.text = title;
- self.buttonTitleLabel.tag = 200+i;
- self.buttonTitleLabel.textColor = [UIColor blackColor];
- self.buttonTitleLabel.font = [UIFont boldSystemFontOfSize:15];
- self.buttonTitleLabel.textAlignment = NSTextAlignmentLeft;
- [_button addSubview:self.buttonTitleLabel];
-
- self.buttonDetailLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.buttonIconImageView.right+10, self.buttonTitleLabel.bottom, _button.width-(self.buttonIconImageView.right+10), 20)];
- self.buttonDetailLabel.text = detai;
- self.buttonDetailLabel.tag = 300+i;
- self.buttonDetailLabel.textColor = [UIColor lightGrayColor];
- self.buttonDetailLabel.font = [UIFont systemFontOfSize:12];
- self.buttonDetailLabel.textAlignment = NSTextAlignmentLeft;
- [_button addSubview:self.buttonDetailLabel];
-
- CGFloat oranginX = CGRectGetMaxX(_button.frame);
- xLeft = oranginX;
- }
-
- self.mainScrollView.contentSize = CGSizeMake(kScreenWidth, self.bottomView.bottom+100);
- }
- #pragma mark -UIScrollView delegate
- - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
-
- int page = (scrollView.contentOffset.x /scrollView.width)+1;
- int p = scrollView.contentOffset.x /scrollView.width;
-
- self.currentPageLabel.text = [NSString stringWithFormat:@"%d",page]; //当前显示的图片数量
- _stepView.stepIndex = p;
-
- if (page*100 >kScreenWidth) { //判断是否超出屏幕
-
- self.grapeScrollView.contentOffset = CGPointMake((page *100)-kScreenWidth, 0);
- }else {
- self.grapeScrollView.contentOffset = CGPointMake(0, 0);
- }
- NSArray *images=@[@"sjlj",@"ltkuang",@"meirhb",@"bqb"];
-
-
- for (int i=0; i<=p; i++) {
- self.zunxiangLabel.text = [NSString stringWithFormat:@"VIP%d尊享",p+1];
-
- for (int a=0; a<images.count; a++) {
- vipDetailModel *string = _dataArr[p];
- UIButton *but = (UIButton *)[self.bottomView viewWithTag:10+a];
- UILabel *titleLabel = (UILabel *)[but viewWithTag:200+a];
-
- if (a==0) {
- titleLabel.text = string.rechargeMoney;
- }if (a==2) {
- titleLabel.text = string.upgradeCoin;
- }
- }
- }
-
- }
- - (UIScrollView *)mainScrollView {
- if (!_mainScrollView) {
- _mainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, self.view.height)];
- _mainScrollView.bounces = NO;
- _mainScrollView.backgroundColor = kWhiteColor;
- [self.view addSubview:_mainScrollView];
- }
- return _mainScrollView;
- }
- @end
|