JXVIPDetailVc.m 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  1. //
  2. // JXVIPDetailViewController.m
  3. // shiku_im
  4. //
  5. // Created by cindy on 2020/5/29.
  6. // Copyright © 2020 Reese. All rights reserved.
  7. //
  8. #import "JXVIPDetailVc.h"
  9. #import "XFStepView.h"
  10. #import "JXVipCenterView.h"
  11. #import "JXMyModel.h"
  12. #import "JXVipDetailTopView.h"
  13. @interface JXVIPDetailVc ()<UIScrollViewDelegate>
  14. @property (nonatomic, strong) UIScrollView *mainScrollView;
  15. @property (strong, nonatomic)UIImageView *topImageView;//顶部背景图
  16. @property (nonatomic,strong) UIImageView *vipGradeBigImageView; //顶部右边最大的等级图
  17. @property (nonatomic,strong) UILabel *vipNumberLabelForBigVIPGradeImageView;
  18. @property (nonatomic,strong) UILabel *vipNumberLabelForvipImageView;
  19. @property (nonatomic,strong) UIImageView *headerImageView;
  20. @property (nonatomic,strong) UILabel *nameLabel;//昵称
  21. @property (nonatomic,strong) UIButton *leftVipGradeLabel;
  22. @property (nonatomic,strong) UIButton *rightVipGradeLabel;
  23. @property (nonatomic,strong) UILabel *progressLabel; //进度Label
  24. @property (nonatomic,strong)UIView *oneDianView;
  25. @property (nonatomic,strong)UIImageView *progressImageView;
  26. @property (nonatomic,strong)UIImageView *progressImageView2;
  27. @property (nonatomic,strong)UIImageView *progressImageView3;
  28. @property (nonatomic,strong)UIImageView *sanjiaoxingView;
  29. @property (nonatomic,strong) UILabel *currentLabel;
  30. @property (nonatomic,strong)UILabel *currentCompanyLabel;
  31. @property (nonatomic,strong)UIView *twoDianView;
  32. @property (nonatomic,strong) UILabel *currentPriceLabel; //当前存款数
  33. @property (nonatomic,strong) UILabel *differencePriceLabel; //升级还差的数
  34. @property (nonatomic,strong) UILabel *differenceLabel;
  35. @property (nonatomic,strong)UILabel *differenceCompanyLabel;
  36. @property (strong, nonatomic)UIView *centerView;
  37. @property (strong, nonatomic)XFStepView *stepView; //等级进度UI
  38. @property (strong, nonatomic)UIScrollView *grapeScrollView;//等级进度UI的ScrollView
  39. @property (strong, nonatomic)UILabel *currentPageLabel;//当前显示的图片数
  40. @property (strong, nonatomic)UIScrollView *centerScrollView;
  41. @property (strong, nonatomic)UIView *bottomView;
  42. @property (strong, nonatomic)UIButton *button;
  43. @property (strong, nonatomic)UILabel *zunxiangLabel;//尊享Label
  44. @property (strong, nonatomic)UIImageView *buttonIconImageView;;
  45. @property (strong, nonatomic)UILabel *buttonTitleLabel;
  46. @property (strong, nonatomic)UILabel *buttonDetailLabel;
  47. @property (nonatomic,strong) NSMutableArray *dataArr;
  48. @property (nonatomic,strong) UIImageView *vipGradeImageView;
  49. @property (nonatomic,assign) int page;
  50. @property (nonatomic,strong) JXVipDetailTopView *topView;
  51. @end
  52. @implementation JXVIPDetailVc
  53. - (void)viewWillAppear:(BOOL)animated{
  54. [super viewWillAppear:animated];
  55. [self.navigationController setNavigationBarHidden:NO];
  56. }
  57. - (void)viewDidLoad {
  58. [super viewDidLoad];
  59. _dataArr=[NSMutableArray array];
  60. //自定义导航栏
  61. [self _createdNavigationBar];
  62. //创建View
  63. [self _createdViews];
  64. }
  65. //自定义导航栏
  66. - (void)_createdNavigationBar {
  67. self.navigationItem.title=@"VIP特权";
  68. long time = (long)[[NSDate date] timeIntervalSince1970];
  69. time = (time *1000 + g_server.timeDifference);
  70. NSString *salt = [NSString stringWithFormat:@"%ld", time];
  71. ///user/vip/info /user/vip/info
  72. [g_server getact_act_userGradelistGrade:salt andToView:self];
  73. [SVProgressHUD show];
  74. [g_server getUserVipInformation:salt andToView:self];
  75. [g_server getUseract_userGradelistGrade:salt andToView:self];
  76. }
  77. #pragma mark --- 请求成功
  78. -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{
  79. // NSLog(@"dict: %@ --- arry: %@",dict ,array1 );
  80. if([aDownload.action isEqualToString:act_userGradelistGrade]){
  81. _dataArr=[vipDetailModel mj_objectArrayWithKeyValuesArray:array1];
  82. // NSArray *smallArray = [_dataArr subarrayWithRange:NSMakeRange(0, 10)];
  83. // _dataArr=[smallArray mutableCopy];
  84. [self _createdCenterView:_dataArr];
  85. }
  86. if([aDownload.action isEqualToString:act_userViplist]){
  87. // _dataArr=[vipDetailModel mj_objectArrayWithKeyValuesArray:array1];
  88. // NSArray *smallArray = [_dataArr subarrayWithRange:NSMakeRange(0, 10)];
  89. //
  90. // _dataArr=[smallArray mutableCopy];
  91. // [self _createdCenterView:_dataArr];
  92. //
  93. // [self _createdBottomView];
  94. }if([aDownload.action isEqualToString:act_GetUserVipInformation]){
  95. [SVProgressHUD dismiss];
  96. self.topView.dictInfo=dict;
  97. //当前等级
  98. NSString *ss = [NSString stringWithFormat:@"%@",dict[@"current"][@"level"]];
  99. int c = [ss intValue];
  100. self.currentPageLabel.text = [NSString stringWithFormat:@"%d",c];
  101. self.centerScrollView.contentOffset = CGPointMake(self.centerScrollView.width*(c), 0);
  102. self.zunxiangLabel.text = [NSString stringWithFormat:@"VIP%d尊享",c];
  103. for (int i=0; i<_dataArr.count; i++) {
  104. if (i == c) {
  105. vipDetailModel *model = _dataArr[c];
  106. self.vipNumberLabelForvipImageView.text =[NSString stringWithFormat:@"%@",model.level];
  107. UIImageView *imageView = (UIImageView *)[_centerView viewWithTag:200+(c)];
  108. UILabel *label1 = (UILabel *)[imageView viewWithTag:1000+(c)];
  109. label1.text = [NSString stringWithFormat:@"VIP%@",model.level];
  110. UILabel *label2 = (UILabel *)[imageView viewWithTag:10000+(c)];
  111. label2.text = [NSString stringWithFormat:@"%@",model.money];
  112. UIButton *but = (UIButton *)[self.bottomView viewWithTag:10];
  113. UIButton *but2 = (UIButton *)[self.bottomView viewWithTag:10+2];
  114. UILabel *titleLabel = (UILabel *)[but viewWithTag:200];
  115. UILabel *titleLabel2 = (UILabel *)[but2 viewWithTag:200+c];
  116. titleLabel.text = model.money;
  117. titleLabel2.text = model.upgradeCoin;
  118. }
  119. }
  120. // [self.mainScrollView reloadInputViews];
  121. }
  122. }
  123. -(CGSize)titleBtnWight:(NSString *)titBtnW and:(UILabel *)titBtn {
  124. CGSize titleSize = [titBtnW boundingRectWithSize:CGSizeMake(MAXFLOAT, 17) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:titBtn.font} context:nil].size;
  125. return titleSize;
  126. }
  127. -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{
  128. [SVProgressHUD dismiss];
  129. NSString * errorCode = [NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]];
  130. if([errorCode isEqualToString:@"权限验证失败"])
  131. {
  132. if ([aDownload.action isEqualToString:act_userViplist])
  133. {
  134. }if([aDownload.action isEqualToString:actuservipinfo]){
  135. }
  136. }
  137. return [errorCode intValue];
  138. }
  139. - (void)goback{
  140. [g_navigation dismissViewController:self animated:NO];
  141. }
  142. - (void)_createdViews {
  143. _dataArr=[NSMutableArray array];
  144. //顶部UI
  145. [self _createdTopView];
  146. }
  147. - (void)gobackxx{
  148. [g_navigation dismissViewController:self animated:YES];
  149. }
  150. - (void)_createdTopView {
  151. JXVipDetailTopView *topView=[JXVipDetailTopView XIBJXVipDetailTopView];
  152. topView.frame=CGRectMake(0, 0, JX_SCREEN_WIDTH, 260);
  153. self.topView=topView;
  154. [self.mainScrollView addSubview:topView];
  155. [topView.gobackBt addTarget:self action:@selector(gobackxx) forControlEvents:UIControlEventTouchUpInside];
  156. return;
  157. //顶部图。V1
  158. self.topImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 250)];
  159. self.topImageView.image=[UIImage imageNamed:@"bgVip02"];
  160. [self.mainScrollView addSubview:self.topImageView];
  161. //最右边VIP等级big图
  162. UIImageView *vipGradeBigImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.topImageView.width-100, 0, 65, 85)];
  163. vipGradeBigImageView.image = [UIImage imageNamed:@"组54"];
  164. [self.topImageView addSubview:vipGradeBigImageView];
  165. UILabel *vip = [[UILabel alloc] initWithFrame:CGRectMake(0, 40, vipGradeBigImageView.width, 15)];
  166. vip.text = @"VIP";
  167. vip.textColor = [UIColor brownColor];
  168. vip.textAlignment = NSTextAlignmentCenter;
  169. vip.font = kBoldFont(8);
  170. [vipGradeBigImageView addSubview:vip];
  171. self.vipNumberLabelForBigVIPGradeImageView = [[UILabel alloc] initWithFrame:CGRectMake(0, vip.bottom, vipGradeBigImageView.width, 15)];
  172. self.vipNumberLabelForBigVIPGradeImageView.text = @"0";
  173. self.vipNumberLabelForBigVIPGradeImageView.textColor = [UIColor brownColor];
  174. self.vipNumberLabelForBigVIPGradeImageView.textAlignment = NSTextAlignmentCenter;
  175. self.vipNumberLabelForBigVIPGradeImageView.font = kBoldFont(20);
  176. [vipGradeBigImageView addSubview:self.vipNumberLabelForBigVIPGradeImageView];
  177. //头像
  178. self.headerImageView = [[UIImageView alloc] initWithFrame:CGRectMake(15, 15, 70, 70)];
  179. self.headerImageView.layer.cornerRadius= 35;
  180. self.headerImageView.layer.masksToBounds = YES;
  181. [self.topImageView addSubview:self.headerImageView];
  182. [g_server delHeadImage:g_server.myself.userId];
  183. [g_server getHeadImageSmall:g_server.myself.userId userName:g_server.myself.userNickname imageView:self.headerImageView];
  184. //昵称
  185. self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.headerImageView.right+15, 30, 100, 25)];
  186. self.nameLabel.text = @"唐小七";
  187. self.nameLabel.textColor = [UIColor blackColor];
  188. self.nameLabel.textAlignment = NSTextAlignmentLeft;
  189. self.nameLabel.font = [UIFont boldSystemFontOfSize:17];
  190. [self.topImageView addSubview:self.nameLabel];
  191. //vip等级
  192. self.vipGradeImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.nameLabel.right+5, 34, 50, 17)];
  193. self.vipGradeImageView.image = [UIImage imageNamed:@"组38"];
  194. //self.vipGradeImageView.backgroundColor = [UIColor yellowColor];
  195. [self.topImageView addSubview:self.vipGradeImageView];
  196. self.leftVipGradeLabel = [[UIButton alloc] initWithFrame:CGRectMake(35, self.headerImageView.bottom+40, 60, 30)];
  197. // self.leftVipGradeLabel .backgroundColor = [UIColor brownColor];
  198. self.leftVipGradeLabel .layer.cornerRadius = 10;
  199. self.leftVipGradeLabel .layer.masksToBounds = YES;
  200. self.leftVipGradeLabel.imageView.contentMode = UIViewContentModeScaleAspectFill;
  201. //[self.leftVipGradeLabel setTitle:@"VIP0" forState:UIControlStateNormal];
  202. self.leftVipGradeLabel.titleLabel.font = [UIFont systemFontOfSize:13];
  203. [self.topImageView addSubview:self.leftVipGradeLabel ];
  204. self.rightVipGradeLabel = [[UIButton alloc] initWithFrame:CGRectMake(self.topImageView.width-80, self.headerImageView.bottom+40, 60, 30)];
  205. //self.rightVipGradeLabel.backgroundColor = [UIColor lightGrayColor];
  206. self.rightVipGradeLabel.layer.cornerRadius = 10;
  207. self.rightVipGradeLabel.layer.masksToBounds = YES;
  208. self.rightVipGradeLabel.imageView.contentMode = UIViewContentModeScaleAspectFill; //[self.leftVipGradeLabel setTitle:@"VIP1" forState:UIControlStateNormal];
  209. self.rightVipGradeLabel.titleLabel.font = [UIFont systemFontOfSize:13];
  210. [self.topImageView addSubview:self.rightVipGradeLabel];
  211. self.progressImageView = [[UIImageView alloc] initWithFrame:CGRectMake(self.leftVipGradeLabel.right+10, self.headerImageView.bottom+45, self.topImageView.width-90-90, 20)];
  212. // self.progressImageView.backgroundColor = [UIColor blueColor];
  213. // self.progressImageView.layer.cornerRadius=7;
  214. self.progressImageView.image = [UIImage imageNamed:@"my_progress"];
  215. self.progressImageView.contentMode = UIViewContentModeScaleToFill;
  216. [self.topImageView addSubview:self.progressImageView];
  217. self.progressImageView2 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 0, 20)];
  218. self.progressImageView2.layer.cornerRadius=7;
  219. self.progressImageView2.backgroundColor = kRGBColor(222, 186, 152);
  220. [self.progressImageView addSubview:self.progressImageView2];
  221. self.progressImageView3 = [[UIImageView alloc] initWithFrame:CGRectMake(self.leftVipGradeLabel.right+10, self.headerImageView.bottom+39, 42 , 32)];
  222. self.progressImageView3.image = [UIImage imageNamed:@"组37"];
  223. [self.topImageView addSubview:self.progressImageView3];
  224. self.progressLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.leftVipGradeLabel.right+self.progressImageView2.width, self.headerImageView.bottom+15, 50, 20)];
  225. self.progressLabel.text = @"2%";
  226. self.progressLabel.textColor = [UIColor blackColor];
  227. self.progressLabel.textAlignment = NSTextAlignmentLeft;
  228. self.progressLabel.font = [UIFont systemFontOfSize:13];
  229. [self.topImageView addSubview:self.progressLabel];
  230. self.sanjiaoxingView = [[UIImageView alloc] initWithFrame:CGRectMake(self.leftVipGradeLabel.right+self.progressImageView2.width, self.progressLabel.bottom, 15, 10)];
  231. self.sanjiaoxingView.image = [UIImage imageNamed:@"组38"];
  232. // self.sanjiaoxingView.backgroundColor = [UIColor redColor];
  233. [self.topImageView addSubview:self.sanjiaoxingView];
  234. //当前累计存款
  235. self.oneDianView = [[UIView alloc] initWithFrame:CGRectMake(35, self.headerImageView.bottom+100, 6, 6)];
  236. self.oneDianView.layer.cornerRadius = 3;
  237. self.oneDianView.layer.masksToBounds = YES;
  238. self.oneDianView.backgroundColor = [UIColor grayColor];
  239. [self.topImageView addSubview:self.oneDianView];
  240. self.currentLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.oneDianView.right+3, self.headerImageView.bottom+96, 260, 15)];
  241. self.currentLabel.textAlignment = NSTextAlignmentLeft;
  242. self.currentLabel.textColor = [UIColor purpleColor];
  243. self.currentLabel.font = [UIFont systemFontOfSize:12];
  244. self.currentLabel.text = @"当前累计存款(元):";
  245. [self.topImageView addSubview:self.currentLabel];
  246. return;
  247. self.currentPriceLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.currentLabel.right+3, self.headerImageView.bottom+96, 100+5, 15)];
  248. self.currentPriceLabel.textAlignment = NSTextAlignmentLeft;
  249. self.currentPriceLabel.textColor = [UIColor blackColor];
  250. self.currentPriceLabel.font = [UIFont systemFontOfSize:12];
  251. self.currentPriceLabel.text = @"0.00";
  252. [self.topImageView addSubview:self.currentPriceLabel];
  253. self.currentCompanyLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.currentPriceLabel.right+3, self.headerImageView.bottom+96, 100, 15)];
  254. self.currentCompanyLabel.textAlignment = NSTextAlignmentLeft;
  255. self.currentCompanyLabel.textColor = [UIColor purpleColor];
  256. self.currentCompanyLabel.font = [UIFont systemFontOfSize:12];
  257. self.currentCompanyLabel.text = @"(0.00/500)";
  258. [self.topImageView addSubview:self.currentCompanyLabel];
  259. //还差升级存款
  260. self.twoDianView = [[UIView alloc] initWithFrame:CGRectMake(35, self.currentLabel.bottom+14, 6, 6)];
  261. self.twoDianView.layer.cornerRadius = 3;
  262. self.twoDianView.layer.masksToBounds = YES;
  263. self.twoDianView.backgroundColor = [UIColor grayColor];
  264. [self.topImageView addSubview:self.twoDianView];
  265. self.differenceLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.twoDianView.right+3, self.currentLabel.bottom+10, 100, 15)];
  266. self.differenceLabel.textAlignment = NSTextAlignmentLeft;
  267. self.differenceLabel.textColor = [UIColor purpleColor];
  268. self.differenceLabel.font = [UIFont systemFontOfSize:12];
  269. self.differenceLabel.text = @"还差升级存款(元):";
  270. [self.topImageView addSubview:self.differenceLabel];
  271. self.differencePriceLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.differenceLabel.right+3, self.currentLabel.bottom+10, 100, 15)];
  272. self.differencePriceLabel.textAlignment = NSTextAlignmentLeft;
  273. self.differencePriceLabel.textColor = [UIColor blackColor];
  274. self.differencePriceLabel.font = [UIFont systemFontOfSize:12];
  275. self.differencePriceLabel.text = @"0.00";
  276. [self.topImageView addSubview:self.differencePriceLabel];
  277. self.differenceCompanyLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.differencePriceLabel.right+3, self.currentLabel.bottom+10, 100, 15)];
  278. self.differenceCompanyLabel.textAlignment = NSTextAlignmentLeft;
  279. self.differenceCompanyLabel.textColor = [UIColor purpleColor];
  280. self.differenceCompanyLabel.font = [UIFont systemFontOfSize:12];
  281. self.differenceCompanyLabel.text = @"(0.00/3,000)";
  282. [self.topImageView addSubview:self.differenceCompanyLabel];
  283. }
  284. - (void)_createdCenterView:(NSMutableArray *)array {
  285. self.centerView = [[UIView alloc] initWithFrame:CGRectMake(0, self.topView.bottom+20, kScreenWidth, 210)];
  286. [self.mainScrollView addSubview:self.centerView];
  287. //等级ScrollView
  288. self.grapeScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.centerView.width, 40)];
  289. self.grapeScrollView.contentSize = CGSizeMake(100*array.count, 40);
  290. self.grapeScrollView.bounces = NO;
  291. [self.centerView addSubview:self.grapeScrollView];
  292. //等级UI
  293. _stepView = [[XFStepView alloc]initWithFrame:CGRectMake(0, 0, 100*array.count, 40) Titles:array];
  294. [self.grapeScrollView addSubview:_stepView];
  295. self.centerScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(50, self.grapeScrollView.bottom+10, kScreenWidth-100, 120)];
  296. self.centerScrollView.delegate = self;
  297. self.centerView.clipsToBounds = NO;
  298. self.centerScrollView.clipsToBounds = NO;
  299. self.centerScrollView.pagingEnabled = YES;
  300. self.centerScrollView.bounces = NO;
  301. self.centerScrollView.showsHorizontalScrollIndicator = NO;
  302. self.centerScrollView.contentSize = CGSizeMake(self.centerScrollView.width*array.count, 120);
  303. [self.centerView addSubview:self.centerScrollView];
  304. //创建图片
  305. for(int i = 0; i <array.count;i++) {
  306. CGRect frame = self.centerScrollView.frame;
  307. vipDetailModel *model=array[i];
  308. UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(frame.size.width * i + 10, 0, self.centerScrollView.width-20, 120)];
  309. imageView.tag = 200+i;
  310. imageView.layer.cornerRadius = 12;
  311. imageView.layer.masksToBounds = YES;
  312. imageView.backgroundColor = RGBColor(207, 194, 200);
  313. [self.centerScrollView addSubview:imageView];
  314. UIImageView *vipImageView = [[UIImageView alloc] initWithFrame:CGRectMake(imageView.width-70, 0, 55, 80)];
  315. vipImageView.image = [UIImage imageNamed:@"组54"];
  316. [imageView addSubview:vipImageView];
  317. UILabel *vipLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 30, vipImageView.width, 15)];
  318. vipLabel.text = @"VIP";
  319. vipLabel.textColor = [UIColor brownColor];
  320. vipLabel.textAlignment = NSTextAlignmentCenter;
  321. vipLabel.font = kBoldFont(8);
  322. [vipImageView addSubview:vipLabel];
  323. self.vipNumberLabelForvipImageView = [[UILabel alloc] initWithFrame:CGRectMake(0, vipLabel.bottom, vipImageView.width, 15)];
  324. self.vipNumberLabelForvipImageView.text =[NSString stringWithFormat:@"%@",model.level];
  325. self.vipNumberLabelForvipImageView.textColor = [UIColor brownColor];
  326. self.vipNumberLabelForvipImageView.textAlignment = NSTextAlignmentCenter;
  327. self.vipNumberLabelForvipImageView.font = kBoldFont(20);
  328. [vipImageView addSubview:self.vipNumberLabelForvipImageView];
  329. UILabel *dengjiLabel = [[UILabel alloc] initWithFrame:CGRectMake(30, 30, 100, 20)];
  330. dengjiLabel.textColor = kWhiteColor;
  331. dengjiLabel.textAlignment = NSTextAlignmentLeft;
  332. dengjiLabel.font = kBoldFont(22);
  333. dengjiLabel.tag = 1000+i;
  334. dengjiLabel.text = [NSString stringWithFormat:@"VIP%@",model.level];
  335. [imageView addSubview:dengjiLabel];
  336. UILabel *leijiPriceLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, dengjiLabel.bottom+25, 90, 15)];
  337. leijiPriceLabel.textColor = kWhiteColor;
  338. leijiPriceLabel.textAlignment = NSTextAlignmentCenter;
  339. leijiPriceLabel.font = kFont(13);
  340. leijiPriceLabel.tag = 10000+i;
  341. leijiPriceLabel.text = [NSString stringWithFormat:@"%@",model.money];
  342. [imageView addSubview:leijiPriceLabel];
  343. UILabel *leijiLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, leijiPriceLabel.bottom+5, 90, 15)];
  344. leijiLabel.textColor = kWhiteColor;
  345. leijiLabel.textAlignment = NSTextAlignmentCenter;
  346. leijiLabel.font = kFont(13);
  347. leijiLabel.text = @"累计存款";
  348. [imageView addSubview:leijiLabel];
  349. }
  350. self.currentPageLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.centerView.width-90, self.centerScrollView.bottom+10, 30, 20)];
  351. self.currentPageLabel.text = @"1";
  352. self.currentPageLabel.textColor = [UIColor blackColor];
  353. self.currentPageLabel.textAlignment = NSTextAlignmentRight;
  354. self.currentPageLabel.font = [UIFont systemFontOfSize:14];
  355. [self.centerView addSubview:self.currentPageLabel];
  356. UILabel *totalPageLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.currentPageLabel.right, self.centerScrollView.bottom+10, 30, 20)];
  357. totalPageLabel.text = [NSString stringWithFormat:@"/%zd",_dataArr.count];
  358. totalPageLabel.textColor = [UIColor purpleColor];
  359. totalPageLabel.textAlignment = NSTextAlignmentLeft;
  360. totalPageLabel.font = [UIFont systemFontOfSize:14];
  361. [self.centerView addSubview:totalPageLabel];
  362. }
  363. - (void)_createdBottomView {
  364. self.bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, self.centerView.bottom+10, kScreenWidth, 200)];
  365. [self.mainScrollView addSubview:self.bottomView];
  366. // UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 2)];
  367. // lineView.backgroundColor = [UIColor grayColor];
  368. // [self.bottomView addSubview:lineView];
  369. UIView *lineTwoView = [[UIView alloc] initWithFrame:CGRectMake(0,0, kScreenWidth, 10)];
  370. lineTwoView.backgroundColor = kRGBColor(246, 246, 246);
  371. [self.bottomView addSubview:lineTwoView];
  372. lineTwoView.layer.shadowColor = kRGBColor(232, 232, 232).CGColor;//阴影颜色
  373. lineTwoView.layer.shadowOffset = CGSizeMake(0, 0);//偏移距离
  374. lineTwoView.layer.shadowOpacity = 0.5;//不透明度
  375. lineTwoView.layer.shadowRadius = 10.0;//半径
  376. UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(15, lineTwoView.bottom+15, 2, 20)];
  377. imgView.backgroundColor= [UIColor redColor];
  378. [self.bottomView addSubview:imgView];
  379. self.zunxiangLabel = [[UILabel alloc] initWithFrame:CGRectMake(imgView.right+5, 20, 130, 30)];
  380. self.zunxiangLabel.text = @"VIP1尊享";
  381. self.zunxiangLabel.textColor = [UIColor blackColor];
  382. self.zunxiangLabel.textAlignment = NSTextAlignmentLeft;
  383. self.zunxiangLabel.font = [UIFont boldSystemFontOfSize:22];
  384. [self.bottomView addSubview:self.zunxiangLabel];
  385. NSArray *imageArray = @[@"sjlj",@"ltkuang",@"meirhb",@"bqb"];
  386. NSArray *titleArray = @[
  387. @"500",@"聊天框",@"1",@"表情包"];
  388. NSArray *detailArray = @[
  389. @"升级礼金(晋级自动发放)",@"1(我—设置里更改)",@"每日红包(每天结算)",@"1(V6以上解锁第二套)",];
  390. int xLeft = 0;
  391. int yleft = imgView.bottom;
  392. CGFloat buttonWidth = (kScreenWidth-30)/2;
  393. for (int i=0; i<imageArray.count; i++) {
  394. NSString *title = titleArray[i];
  395. NSString *detai = detailArray[i];
  396. _button = [UIButton buttonWithType:UIButtonTypeCustom];
  397. if (xLeft +buttonWidth > kScreenWidth){
  398. xLeft = 0;
  399. yleft = yleft+10+50;
  400. }
  401. _button.frame = CGRectMake(xLeft + 10, yleft + 10, buttonWidth, 50);
  402. _button.tag = 10+i;
  403. [self.bottomView addSubview:_button];
  404. self.buttonIconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(15, 0, 25, 40)];
  405. self.buttonIconImageView.image = [UIImage imageNamed:imageArray[i]];
  406. self.buttonIconImageView.contentMode=UIViewContentModeScaleAspectFit;
  407. self.buttonIconImageView.tag = 100+i;
  408. [_button addSubview:self.buttonIconImageView];
  409. self.buttonTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.buttonIconImageView.right+10, 0, _button.width-(self.buttonIconImageView.right+10), 20)];
  410. self.buttonTitleLabel.text = title;
  411. self.buttonTitleLabel.tag = 200+i;
  412. self.buttonTitleLabel.textColor = [UIColor blackColor];
  413. self.buttonTitleLabel.font = [UIFont boldSystemFontOfSize:15];
  414. self.buttonTitleLabel.textAlignment = NSTextAlignmentLeft;
  415. [_button addSubview:self.buttonTitleLabel];
  416. self.buttonDetailLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.buttonIconImageView.right+10, self.buttonTitleLabel.bottom, _button.width-(self.buttonIconImageView.right+10), 20)];
  417. self.buttonDetailLabel.text = detai;
  418. self.buttonDetailLabel.tag = 300+i;
  419. self.buttonDetailLabel.textColor = [UIColor lightGrayColor];
  420. self.buttonDetailLabel.font = [UIFont systemFontOfSize:12];
  421. self.buttonDetailLabel.textAlignment = NSTextAlignmentLeft;
  422. [_button addSubview:self.buttonDetailLabel];
  423. CGFloat oranginX = CGRectGetMaxX(_button.frame);
  424. xLeft = oranginX;
  425. }
  426. self.mainScrollView.contentSize = CGSizeMake(kScreenWidth, self.bottomView.bottom+100);
  427. }
  428. #pragma mark -UIScrollView delegate
  429. - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
  430. int page = (scrollView.contentOffset.x /scrollView.width)+1;
  431. int p = scrollView.contentOffset.x /scrollView.width;
  432. self.currentPageLabel.text = [NSString stringWithFormat:@"%d",page]; //当前显示的图片数量
  433. _stepView.stepIndex = p;
  434. if (page*100 >kScreenWidth) { //判断是否超出屏幕
  435. self.grapeScrollView.contentOffset = CGPointMake((page *100)-kScreenWidth, 0);
  436. }else {
  437. self.grapeScrollView.contentOffset = CGPointMake(0, 0);
  438. }
  439. NSArray *images=@[@"sjlj",@"ltkuang",@"meirhb",@"bqb"];
  440. for (int i=0; i<=p; i++) {
  441. self.zunxiangLabel.text = [NSString stringWithFormat:@"VIP%d尊享",p+1];
  442. for (int a=0; a<images.count; a++) {
  443. vipDetailModel *string = _dataArr[p];
  444. UIButton *but = (UIButton *)[self.bottomView viewWithTag:10+a];
  445. UILabel *titleLabel = (UILabel *)[but viewWithTag:200+a];
  446. if (a==0) {
  447. titleLabel.text = string.rechargeMoney;
  448. }if (a==2) {
  449. titleLabel.text = string.upgradeCoin;
  450. }
  451. }
  452. }
  453. }
  454. - (UIScrollView *)mainScrollView {
  455. if (!_mainScrollView) {
  456. _mainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, self.view.height)];
  457. _mainScrollView.bounces = NO;
  458. _mainScrollView.backgroundColor = kWhiteColor;
  459. [self.view addSubview:_mainScrollView];
  460. }
  461. return _mainScrollView;
  462. }
  463. @end