123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- //
- // LDAchievementDetailView.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/8/2.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "LDAchievementDetailView.h"
- @interface LDAchievementDetailView () {
- NSArray *_titles;
- }
- @end
- @implementation LDAchievementDetailView
- - (instancetype)initWithFrame:(CGRect)frame titles:(NSArray *)titles{
- self = [super initWithFrame:frame];
- if (self) {
- _titles = titles;
- [self initSubViews];
- }
- return self;
- }
- - (void)initSubViews {
-
-
- CGFloat width = self.width/4;
- CGFloat height = Fitsize(20);
- self.height = width + Fitsize(10);
-
- for (int i = 0; i < _titles.count; i++) {
-
- UIView *bg = [[UIView alloc] initWithFrame:CGRectMake(self.width/2 * i, 0, self.width/2, self.height)];
- [self addSubview:bg];
- UIView *alphaView = [[UIView alloc] initWithFrame:bg.bounds];
- alphaView.backgroundColor = [UIColor clearColor];
- alphaView.tag = 1000+i;
- UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapViewAction:)];
- [alphaView addGestureRecognizer:tap];
- [bg addSubview:alphaView];
-
- UILabel *topTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, bg.width, FITSIZE(40))];
- topTitle.textAlignment = NSTextAlignmentCenter;
- topTitle.font = [UIFont systemFontOfSize:Fitsize(14)];
- topTitle.textColor = [UIColor YHColorWithHex:0x333333];
- topTitle.text = _titles[i];
- [bg addSubview:topTitle];
-
-
- NSArray *subTitles = @[@"订单",@"佣金"];
- for (int j = 0; j < subTitles.count; j++) {
- UILabel *detailLb = [[UILabel alloc] initWithFrame:CGRectMake(self.width/4 * (j%4),topTitle.bottom + (j/4)*height, width, height)];
- detailLb.text = @"--";
- detailLb.font = [UIFont boldSystemFontOfSize:Fitsize(16)];
- detailLb.textAlignment = NSTextAlignmentCenter;
- detailLb.textColor = [UIColor homeRedColor];
- detailLb.tag = (i+1)*2000+j;
- [bg addSubview:detailLb];
- UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(width * (j%4),detailLb.bottom+Fitsize(10), width, height)];
- title.text = subTitles[j];
- title.textColor = [UIColor YHColorWithHex:0x7c7c7c];
- title.font = [UIFont systemFontOfSize:Fitsize(12)];
- title.textAlignment = NSTextAlignmentCenter;
- [bg addSubview:title];
- }
-
- }
-
- UILabel *line = [[UILabel alloc] initWithFrame:CGRectMake(self.width/2, 0, 1, Fitsize(80))];
- line.backgroundColor = [UIColor yhGrayColor];
- line.centerY = self.height/2;
- [self addSubview:line];
- }
- - (void)setAccountInfo:(NSArray *)infoArr {
- for (int i = 0; i < infoArr.count; i++) {
- NSArray *arr = infoArr[i];
- for (int j = 0; j < arr.count; j++) {
- UILabel *label = [self viewWithTag:(i+1)*2000+j];
- label.text = arr[j];
- }
- }
- }
- - (void)tapViewAction:(UITapGestureRecognizer *)tap {
- NSInteger index = tap.view.tag - 1000;
- if (self.tapIncomeBlock) {
- self.tapIncomeBlock(index);
- }
- }
- @end
|