123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- //
- // KXMarkView.m
- // CAISHEN
- //
- // Created by kuxuan on 2017/8/28.
- // Copyright © 2017年 kuxuan. All rights reserved.
- //
- #import "KXMarkView.h"
- @implementation KXMarkView
- {
- UIView *_whiteView;
- }
- - (instancetype)initWithFrame:(CGRect)frame
- {
- if (self = [super initWithFrame:frame]) {
- self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.4];
- [self setupUI];
- }
- return self;
- }
- - (void)setupUI
- {
-
- NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
- // app名称
- NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"];
-
- _whiteView = [[UIView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH/2.0-150, 180*SCREEN_MUTI, 300, 320)];
- _whiteView.center = self.center;
- _whiteView.layer.cornerRadius = 8;
- _whiteView.layer.masksToBounds = YES;
- _whiteView.backgroundColor = [UIColor whiteColor];
- [self addSubview:_whiteView];
-
- UILabel *markLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 26, 300, 18)];
- markLabel.textColor = [UIColor titleColor];
- markLabel.text = [NSString stringWithFormat:@"给%@打分",app_Name];
- markLabel.textAlignment = NSTextAlignmentCenter;
- markLabel.font = FONT_SYS(16);
- [_whiteView addSubview:markLabel];
-
- UILabel *markDetailLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 52, 260, 40)];
- markDetailLabel.textColor = [UIColor KXColorWithHex:0x666666];
- markDetailLabel.text = [NSString stringWithFormat:@"喜欢新版%@吗?打分鼓励一下吧~您的肯定是我们前进的动力",app_Name];
- markDetailLabel.numberOfLines = 0;
- markDetailLabel.textAlignment = NSTextAlignmentCenter;
- markDetailLabel.font = FONT_SYS(14);
- [_whiteView addSubview:markDetailLabel];
-
- UILabel *lineLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 110, 260, 1)];
- lineLabel.backgroundColor = [UIColor lineColor];
- [_whiteView addSubview:lineLabel];
-
- NSArray *markImageArray = @[@"main_mark_1",@"main_mark_2",@"main_mark_3"];
- for (int i = 0; i < 3; i++) {
- UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
- button.frame = CGRectMake(50, 130+54*i, 200, 40);
- [button setImage:[UIImage imageNamed:markImageArray[i]] forState:UIControlStateNormal];
- button.tag = 888 + i;
- [button addTarget:self action:@selector(markAction:) forControlEvents:UIControlEventTouchUpInside];
- [_whiteView addSubview:button];
- }
- }
- - (void)markAction:(UIButton *)btn
- {
- [_delegate markViewSelectMarkItem:btn.tag-888];
- [self.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
- [obj removeFromSuperview];
- }];
- [self removeFromSuperview];
- }
- @end
|