123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- //
- // YOUPAILCUpdateVersionVC.m
- // zhimi
- //
- // Created by Apple on 2019/11/5.
- // Copyright © 2019 caiPro. All rights reserved.
- //
- #import "YOUPAILCUpdateVersionVC.h"
- #import "UIViewController+TFPresent.h"
- @interface YOUPAILCUpdateVersionVC ()<UIGestureRecognizerDelegate,CAAnimationDelegate>
- @property(nonatomic,strong)UILabel *youpaipupdateTextLab,*youpaiptitleLab,*youpaipversionLab;
- @property(nonatomic,strong)UIButton *youpaipupdateBtn;
- @property(nonatomic,strong)UIButton *youpaipnoBtn;
- @property(nonatomic,strong)UIImageView *youpaipbackImageView;
- @end
- @implementation YOUPAILCUpdateVersionVC
- - (void)viewDidLoad {
- [super viewDidLoad];
- // [self.view setFrame:CGRectMake(0, 0, _screenWidth, _screenHeight)];
- // [self.view setBackgroundColor:[UIColor clearColor]];
- // CAShapeLayer *maskLayer = [CAShapeLayer layer];
- // UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.view.bounds cornerRadius:10];
- // maskLayer.path = path.CGPath;
- // self.view.layer.mask = maskLayer;
-
- UIView *whiteView = [[UIView alloc] init];
- [self.baseView addSubview:whiteView];
-
- whiteView.backgroundColor = LCWhiteColor;
- [whiteView mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.baseView.mas_left).with.offset(0);
- make.right.equalTo(self.baseView.mas_right).with.offset(0);
- make.top.equalTo(self.baseView.mas_top).with.offset(self.vWidth*31.5/305.0);
- make.bottom.equalTo(self.baseView.mas_bottom).with.offset(0);
- }];
-
- UIView *baseView = [[UIView alloc] init];
- [whiteView addSubview:baseView];
- baseView.backgroundColor = HexColorFromRGB(0xF8F8FF);
- baseView.layer.cornerRadius = 8;
- baseView.layer.masksToBounds = YES;
- [baseView mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(whiteView.mas_left).with.offset(31);
- make.right.equalTo(whiteView.mas_right).with.offset(-31);
- make.top.equalTo(whiteView.mas_top).with.offset(0);
- make.bottom.equalTo(whiteView.mas_bottom).with.offset(-31);
- }];
-
- [self.baseView addSubview:self.youpaipbackImageView];
- [_youpaipbackImageView setFrame:CGRectMake(0, 0, self.vWidth, self.vWidth*203/305.0)];
- [_youpaipbackImageView setImage:[UIImage imageNamed:@"vqu_images_P_version"]];
-
-
- [baseView addSubview:self.youpaiptitleLab];
- [_youpaiptitleLab setText:@"发现新版本"];
- [_youpaiptitleLab mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(baseView.mas_left).with.offset(0);
- make.right.equalTo(baseView.mas_right).with.offset(0);
- make.top.equalTo(baseView.mas_top).with.offset(self.vWidth*171.5/305.0+25);
- make.height.equalTo(@23);
- }];
-
-
- [baseView addSubview:self.youpaipversionLab];
- [_youpaipversionLab mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(baseView.mas_left).with.offset(27);
- make.right.equalTo(baseView.mas_right).with.offset(-10);
- make.top.equalTo(self->_youpaiptitleLab.mas_bottom).with.offset(14);
- make.height.equalTo(@17);
- }];
- [_youpaipversionLab setText:[NSString stringWithFormat:@"V %@",self.youpaipversionStr]];
-
-
- [baseView addSubview:self.youpaipupdateBtn];
- [_youpaipupdateBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(baseView.mas_left).with.offset(59);
- make.right.equalTo(baseView.mas_right).with.offset(-59);
- make.bottom.equalTo(baseView.mas_bottom).with.offset(-32);
- make.height.equalTo(@30);
- }];
-
- [baseView addSubview:self.youpaipnoBtn];
- [_youpaipnoBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(baseView.mas_left).with.offset(59);
- make.right.equalTo(baseView.mas_right).with.offset(-59);
- make.bottom.equalTo(baseView.mas_bottom).with.offset(-15);
- make.height.equalTo(@12);
- }];
-
-
- [baseView addSubview:self.youpaipupdateTextLab];
- [_youpaipupdateTextLab mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(baseView.mas_left).with.offset(27);
- make.right.equalTo(baseView.mas_right).with.offset(-27);
- make.bottom.equalTo(self->_youpaipupdateBtn.mas_top).with.offset(-27);
- make.top.equalTo(self->_youpaipversionLab.mas_bottom).with.offset(7);
- }];
-
-
- [_youpaipupdateTextLab setText:_youpaipupdateText];
- NSLog(@"%@",_youpaipupdateText);
-
-
- }
- -(UILabel*)youpaiptitleLab
- {
- if(!_youpaiptitleLab)
- {
- _youpaiptitleLab = [[UILabel alloc]init];
- [_youpaiptitleLab setTextColor:HexColorFromRGB(0x333333)];
- [_youpaiptitleLab setFont:LCBoldFont(19)];
- [_youpaiptitleLab setTextAlignment:NSTextAlignmentCenter];
- }
- return _youpaiptitleLab;
- }
- -(UILabel*)youpaipversionLab
- {
- if(!_youpaipversionLab)
- {
- _youpaipversionLab = [[UILabel alloc]init];
- [_youpaipversionLab setTextColor:HexColorFromRGB(0x626262)];
- [_youpaipversionLab setFont:LCFont(14)];
- }
- return _youpaipversionLab;
- }
- -(UILabel*)youpaipupdateTextLab
- {
- if(!_youpaipupdateTextLab)
- {
- _youpaipupdateTextLab = [[UILabel alloc]init];
- [_youpaipupdateTextLab setTextColor:HexColorFromRGB(0x626262)];
- _youpaipupdateTextLab.numberOfLines =0;
- _youpaipupdateTextLab.lineBreakMode = NSLineBreakByWordWrapping;
- [_youpaipupdateTextLab setFont:[UIFont systemFontOfSize:14]];
- [_youpaipupdateTextLab setTextAlignment:NSTextAlignmentLeft];
- }
- return _youpaipupdateTextLab;
- }
- -(UIButton *)youpaipupdateBtn
- {
- if(_youpaipupdateBtn==nil)
- {
- _youpaipupdateBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- // [_updateBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(KScreenWidth-120, 44) FromColors:@[LCGradientOneColor,LCGradientTwoColor] ByGradientType:(GradientLeftToRight)] forState:(UIControlStateNormal)];
- [_youpaipupdateBtn setBackgroundColor:HexColorFromRGB(0xA7A9FD)];
- [_youpaipupdateBtn setTitle:@"立即升级" forState:UIControlStateNormal];
- _youpaipupdateBtn.titleLabel.textColor = [UIColor whiteColor];
- _youpaipupdateBtn.titleLabel.textAlignment = NSTextAlignmentCenter;
- [_youpaipupdateBtn.titleLabel setFont:[UIFont systemFontOfSize:14]];
- _youpaipupdateBtn.layer.cornerRadius = 15;
- _youpaipupdateBtn.layer.masksToBounds = YES;
- [_youpaipupdateBtn addTarget:self action:@selector(youpaifupdateApp) forControlEvents:UIControlEventTouchUpInside];
-
- }
- return _youpaipupdateBtn;
- }
- -(UIButton *)youpaipnoBtn
- {
- if(_youpaipnoBtn==nil)
- {
- _youpaipnoBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [_youpaipnoBtn setTitle:@"以后再说" forState:UIControlStateNormal];
- [_youpaipnoBtn setTitleColor:HexColorFromRGB(0x999999) forState:0];
- [_youpaipnoBtn.titleLabel setFont:[UIFont systemFontOfSize:10]];
- [_youpaipnoBtn addTarget:self action:@selector(youpaifnoBtnAction) forControlEvents:UIControlEventTouchUpInside];
-
- }
- return _youpaipnoBtn;
- }
- -(UIImageView*)youpaipbackImageView
- {
- if(!_youpaipbackImageView)
- {
- _youpaipbackImageView = [[UIImageView alloc]init];
-
- }
- return _youpaipbackImageView;
- }
- -(void)youpaifupdateApp
- {
- [[UIApplication sharedApplication] openURL:[NSURL URLWithString:self.youpaipdownLoadUrl]];
- if(self.youpaipenforce ==0)
- [self dismissViewControllerAnimated:YES completion:nil];
- // [[UIApplication sharedApplication] openURL:[NSURL URLWithString:self.downLoadUrl]];
- }
- -(void)youpaifshakeWindow
- {
- //shakeType 1 左右抖动 2左边抖动
- [self youpaiflayerRotation:self.view RepeatTime:1 shakeType:1];
- }
- - (void)youpaiflayerRotation:(UIView *)view RepeatTime:(NSInteger )repatTime shakeType:(NSInteger)shakeType{
- CAKeyframeAnimation *keyAnimation = [CAKeyframeAnimation animation];
- // 旋转角度, 其中的value表示图像旋转的最终位置
- if(shakeType == 1)
- {
- keyAnimation.values = [NSArray arrayWithObjects:
- [NSValue valueWithCATransform3D:CATransform3DMakeRotation(0, 0,1,0)],
- [NSValue valueWithCATransform3D:CATransform3DMakeRotation((M_PI/8), 0,1,0)],
- [NSValue valueWithCATransform3D:CATransform3DMakeRotation(0, 0,1,0)],
- [NSValue valueWithCATransform3D:CATransform3DMakeRotation(-(M_PI/8), 0,1,0)],
- [NSValue valueWithCATransform3D:CATransform3DMakeRotation(0, 0,1,0)],nil];
- }
- else
- {
- keyAnimation.values = [NSArray arrayWithObjects:
- [NSValue valueWithCATransform3D:CATransform3DMakeRotation(0, 0,1,0)],
- [NSValue valueWithCATransform3D:CATransform3DMakeRotation((M_PI/8), 0,1,0)],
- [NSValue valueWithCATransform3D:CATransform3DMakeRotation(0, 0,1,0)],nil];
- }
- keyAnimation.cumulative = NO;
- keyAnimation.duration = 0.6 * 1;
- keyAnimation.repeatCount = repatTime;
- keyAnimation.removedOnCompletion = NO;
- keyAnimation.delegate = self;
- [view.layer addAnimation:keyAnimation forKey:@"transform"];
- // [self performSelector:@selector(changeImg) withObject:nil afterDelay:0.6 * 1];
- }
- -(void)youpaifnoBtnAction
- {
- [self TFDismissViewController];
- }
- @end
|