|
|
@@ -8,6 +8,10 @@
|
|
|
#import "imageVersionRenewTipView.h"
|
|
|
@interface imageVersionRenewTipView ()
|
|
|
@property (nonatomic,strong) UIView* whiteBgView;
|
|
|
+@property (nonatomic,strong) UIButton *updateNowBut;
|
|
|
+@property (nonatomic,strong) CAGradientLayer *gradientLayer;
|
|
|
+@property (nonatomic,strong) UILabel *tip1Lab;
|
|
|
+
|
|
|
@end
|
|
|
|
|
|
@implementation imageVersionRenewTipView
|
|
|
@@ -27,9 +31,9 @@
|
|
|
[self addSubview:_whiteBgView];
|
|
|
|
|
|
[_whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.height.mas_equalTo(332);
|
|
|
- make.width.mas_equalTo(300.f);
|
|
|
- make.centerY.mas_equalTo(-50.f);
|
|
|
+ make.height.mas_equalTo(369.f);
|
|
|
+ make.width.mas_equalTo(323.f*AUTOSCALE);
|
|
|
+ make.centerY.mas_equalTo(-40.f);
|
|
|
make.centerX.mas_equalTo(0.f);
|
|
|
}];
|
|
|
|
|
|
@@ -38,8 +42,8 @@
|
|
|
[_whiteBgView addSubview:topImage];
|
|
|
|
|
|
[topImage mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.height.mas_equalTo(160);
|
|
|
- make.width.mas_equalTo(300.f);
|
|
|
+ make.height.mas_equalTo(244*AUTOSCALE);
|
|
|
+ make.width.mas_equalTo(323.f*AUTOSCALE);
|
|
|
make.left.mas_equalTo(0.f);
|
|
|
make.top.mas_equalTo(-40.f);
|
|
|
}];
|
|
|
@@ -48,106 +52,176 @@
|
|
|
UILabel *titleLab = [[UILabel alloc] init];
|
|
|
titleLab.text = curTitleStr;
|
|
|
titleLab.numberOfLines = 0;
|
|
|
- titleLab.textColor = [UIColor whiteColor];
|
|
|
- titleLab.font = [UIFont boldSystemFontOfSize:22.0];
|
|
|
+ titleLab.textColor = [UIColor blackColor];
|
|
|
+ titleLab.font = [UIFont boldSystemFontOfSize:33.0];
|
|
|
[topImage addSubview:titleLab];
|
|
|
|
|
|
[titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.height.mas_equalTo(60);
|
|
|
make.right.mas_equalTo(0.f);
|
|
|
make.left.mas_equalTo(25.f);
|
|
|
- make.top.mas_equalTo(55.f);
|
|
|
+ make.top.mas_equalTo(42.f);
|
|
|
}];
|
|
|
|
|
|
- NSString *curTip1Str = NSLocalizedString(@"image_version_pop_tip1",nil);
|
|
|
- UILabel *tip1Lab = [[UILabel alloc] init];
|
|
|
- tip1Lab.text = curTip1Str;
|
|
|
- tip1Lab.numberOfLines = 0;
|
|
|
- tip1Lab.textAlignment = NSTextAlignmentCenter;
|
|
|
- tip1Lab.textColor = [UIColor hwColor:@"#151515" alpha:1.0];
|
|
|
- tip1Lab.font = [UIFont systemFontOfSize:16.0];
|
|
|
- [_whiteBgView addSubview:tip1Lab];
|
|
|
-
|
|
|
- CGFloat curHeight = [curTip1Str boundingRectWithSize:CGSizeMake(280, 1000) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16.0]} context:nil].size.height;
|
|
|
-
|
|
|
- curHeight += 15;
|
|
|
-
|
|
|
- [tip1Lab mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.height.mas_equalTo(curHeight);
|
|
|
- make.right.mas_equalTo(-10.f);
|
|
|
- make.left.mas_equalTo(10.f);
|
|
|
- make.top.mas_equalTo(topImage.mas_bottom).offset(20.f);
|
|
|
- }];
|
|
|
+ NSString *curTip1Str = NSLocalizedString(@"image_version_pop_144_tip1",nil);
|
|
|
+ _tip1Lab = [[UILabel alloc] init];
|
|
|
+ //_tip1Lab.text = curTip1Str;
|
|
|
+ _tip1Lab.numberOfLines = 0;
|
|
|
+ //_tip1Lab.textAlignment = NSTextAlignmentCenter;
|
|
|
+ _tip1Lab.textColor = [UIColor hwColor:@"#333333" alpha:1.0];
|
|
|
+ _tip1Lab.font = [UIFont systemFontOfSize:15.0];
|
|
|
+ [_whiteBgView addSubview:_tip1Lab];
|
|
|
+ //_tip1Lab.backgroundColor = [UIColor greenColor];
|
|
|
|
|
|
- NSString *curTip2Str = NSLocalizedString(@"image_version_pop_tip2",nil);
|
|
|
+ NSMutableAttributedString *totalStr = [[NSMutableAttributedString alloc] initWithString:curTip1Str];
|
|
|
|
|
|
- CGFloat curHeight2 = [curTip2Str boundingRectWithSize:CGSizeMake(280, 1000) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16.0]} context:nil].size.height;
|
|
|
+ // 设置行间距
|
|
|
+ NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
|
|
|
+ [paragraphStyle setLineSpacing:5]; //设置行间距
|
|
|
+ [totalStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [totalStr length])];
|
|
|
|
|
|
- curHeight2 += 5;
|
|
|
+ _tip1Lab.attributedText = totalStr;
|
|
|
|
|
|
- UILabel *tip2Lab = [[UILabel alloc] init];
|
|
|
- tip2Lab.text = curTip2Str;
|
|
|
- tip2Lab.numberOfLines = 0;
|
|
|
- tip2Lab.textAlignment = NSTextAlignmentCenter;
|
|
|
- tip2Lab.textColor = [UIColor hwColor:@"#151515" alpha:0.5];
|
|
|
- tip2Lab.font = [UIFont systemFontOfSize:14.0];
|
|
|
- [_whiteBgView addSubview:tip2Lab];
|
|
|
- //tip2Lab.backgroundColor = [UIColor greenColor];
|
|
|
|
|
|
- [tip2Lab mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.height.mas_equalTo(curHeight2);
|
|
|
- make.right.mas_equalTo(-10.f);
|
|
|
- make.left.mas_equalTo(10.f);
|
|
|
- make.top.mas_equalTo(tip1Lab.mas_bottom).offset(10.f);
|
|
|
+ [_tip1Lab mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ //make.height.mas_equalTo(curHeight);
|
|
|
+ make.right.mas_equalTo(-32.0);
|
|
|
+ make.left.mas_equalTo(32.0);
|
|
|
+ make.top.mas_equalTo(165);
|
|
|
}];
|
|
|
|
|
|
- [_whiteBgView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.height.mas_equalTo(240 + curHeight + curHeight2);
|
|
|
- make.width.mas_equalTo(300.f);
|
|
|
- make.centerY.mas_equalTo(-50.f);
|
|
|
- make.centerX.mas_equalTo(0.f);
|
|
|
- }];
|
|
|
+
|
|
|
|
|
|
- UIButton *konwBut = [[UIButton alloc] init];
|
|
|
- [konwBut setTitle:NSLocalizedString(@"guide_set_pwd_guide_know",nil) forState:UIControlStateNormal];
|
|
|
- konwBut.layer.cornerRadius = 8;
|
|
|
- konwBut.layer.masksToBounds = YES;
|
|
|
- [konwBut addTarget:self action:@selector(colseFun) forControlEvents:UIControlEventTouchUpInside];
|
|
|
- [_whiteBgView addSubview:konwBut];
|
|
|
-
|
|
|
- CAGradientLayer *gradientLayer = [CAGradientLayer layer];
|
|
|
- gradientLayer.frame = CGRectMake(0, 0, 160, 48);
|
|
|
- gradientLayer.colors = @[(__bridge NSString *)[UIColor hwColor:@"#0CDEFD" alpha:1.0].CGColor, (__bridge NSString *)[UIColor hwColor:@"#058DFB" alpha:1.0].CGColor];
|
|
|
- gradientLayer.locations = @[@(0), @(1.0f)];
|
|
|
- [konwBut.layer addSublayer:gradientLayer];
|
|
|
-
|
|
|
- [konwBut mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.height.mas_equalTo(48);
|
|
|
- make.width.mas_equalTo(160.f);
|
|
|
+ _updateNowBut = [[UIButton alloc] init];
|
|
|
+ [_updateNowBut setTitle:NSLocalizedString(@"image_version_Update_Now",nil) forState:UIControlStateNormal];
|
|
|
+ //_updateNowBut.layer.cornerRadius = 8;
|
|
|
+ //_updateNowBut.layer.masksToBounds = YES;
|
|
|
+ [_updateNowBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
|
+ [_updateNowBut addTarget:self action:@selector(didClickUpdateFun) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [_whiteBgView addSubview:_updateNowBut];
|
|
|
+
|
|
|
+ _gradientLayer = [CAGradientLayer layer];
|
|
|
+ _gradientLayer.frame = CGRectMake(0, 0, 268, 40);
|
|
|
+ _gradientLayer.colors = @[(__bridge NSString *)[UIColor hwColor:@"#0CDEFD" alpha:1.0].CGColor, (__bridge NSString *)[UIColor hwColor:@"#058DFB" alpha:1.0].CGColor];
|
|
|
+ _gradientLayer.locations = @[@(0), @(1.0f)];
|
|
|
+ _gradientLayer.startPoint = CGPointMake(0, 0.5);
|
|
|
+ _gradientLayer.endPoint = CGPointMake(0.97, 0.5);
|
|
|
+ _gradientLayer.cornerRadius = 8;
|
|
|
+ [_updateNowBut.layer addSublayer:_gradientLayer];
|
|
|
+
|
|
|
+ _updateNowBut.layer.shadowColor = [UIColor hwColor:@"#058DFB"].CGColor;
|
|
|
+ // 设置阴影透明度(0.0到1.0)
|
|
|
+ _updateNowBut.layer.shadowOpacity = 0.5;
|
|
|
+ // 设置阴影偏移量(x, y)
|
|
|
+ _updateNowBut.layer.shadowOffset = CGSizeMake(0, 3);
|
|
|
+ // 设置阴影模糊半径
|
|
|
+ _updateNowBut.layer.shadowRadius = 5.0;
|
|
|
+ // 为了使阴影在按钮外部可见,需要设置masksToBounds为NO
|
|
|
+ // 注意:如果父视图设置了masksToBounds为YES,那么阴影可能仍然不可见
|
|
|
+ _updateNowBut.layer.masksToBounds = NO;
|
|
|
+
|
|
|
+ [_updateNowBut mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.height.mas_equalTo(40.f);
|
|
|
+ make.width.mas_equalTo(268.f);
|
|
|
make.centerX.mas_equalTo(0.f);
|
|
|
make.bottom.mas_equalTo(-30);
|
|
|
}];
|
|
|
|
|
|
|
|
|
- UIButton *colseBut = [[UIButton alloc] init];
|
|
|
- [colseBut setImage:[UIImage imageNamed:@"common_del_white"] forState:UIControlStateNormal];
|
|
|
- [colseBut addTarget:self action:@selector(colseFun) forControlEvents:UIControlEventTouchUpInside];
|
|
|
- [self addSubview:colseBut];
|
|
|
-
|
|
|
- [colseBut mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.height.mas_equalTo(48);
|
|
|
- make.width.mas_equalTo(48.f);
|
|
|
- make.centerX.mas_equalTo(0.f);
|
|
|
- make.top.mas_equalTo(_whiteBgView.mas_bottom).offset(30);
|
|
|
- }];
|
|
|
+// UIButton *colseBut = [[UIButton alloc] init];
|
|
|
+// [colseBut setImage:[UIImage imageNamed:@"common_del_white"] forState:UIControlStateNormal];
|
|
|
+// [colseBut addTarget:self action:@selector(colseFun) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+// [self addSubview:colseBut];
|
|
|
+//
|
|
|
+// [colseBut mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+// make.height.mas_equalTo(48);
|
|
|
+// make.width.mas_equalTo(48.f);
|
|
|
+// make.centerX.mas_equalTo(0.f);
|
|
|
+// make.top.mas_equalTo(_whiteBgView.mas_bottom).offset(30);
|
|
|
+// }];
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+- (void)didClickUpdateFun
|
|
|
+{
|
|
|
+ if(_didClickUpdateNowFun){
|
|
|
+ _didClickUpdateNowFun();
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
- (void)colseFun
|
|
|
{
|
|
|
NSString *datestr = [iTools getNowDateString];
|
|
|
[HWDataManager setObjectWithKey:Const_did_show_image_version_date value:datestr];
|
|
|
[self removeFromSuperview];
|
|
|
+
|
|
|
+ if(_didClickCloseFun){
|
|
|
+ _didClickCloseFun();
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark ota 镜像升级变化
|
|
|
+//状态 -1=没有更新 0=下载中 1=下载完成 2=点击升级 3=宿主机代理导入容器镜像:进度条展示20% 4=导入容器镜像完成:进度条展示50% 5=宿主机代理创建容器镜像:进度条展示80% 6=容器镜像创建完成:进度条展示100%
|
|
|
+- (void)setStatus:(NSInteger)status{
|
|
|
+ if(status <= 1){
|
|
|
+ //默认是1的UI 不用处理
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ [_whiteBgView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.height.mas_equalTo(410.f);
|
|
|
+ }];
|
|
|
+
|
|
|
+ _updateNowBut.userInteractionEnabled = NO;
|
|
|
+ _updateNowBut.layer.masksToBounds = YES;
|
|
|
+ _updateNowBut.layer.shadowColor = [UIColor clearColor].CGColor;
|
|
|
+ _updateNowBut.backgroundColor = [UIColor hwColor:@"#DADBDC"];
|
|
|
+ _updateNowBut.layer.cornerRadius = 8;
|
|
|
+
|
|
|
+ CGFloat curProgress = 0.0;
|
|
|
+ if(status == 2){
|
|
|
+ curProgress = 0.0;
|
|
|
+ }
|
|
|
+ else if(status == 3){
|
|
|
+ curProgress = 0.2;
|
|
|
+ }
|
|
|
+ else if(status == 4){
|
|
|
+ curProgress = 0.5;
|
|
|
+ }
|
|
|
+ else if(status == 5){
|
|
|
+ curProgress = 0.8;
|
|
|
+ }
|
|
|
+ else //if(status == 6)
|
|
|
+ {
|
|
|
+ curProgress = 1.0;
|
|
|
+ }
|
|
|
+
|
|
|
+ _gradientLayer.frame = CGRectMake(0, 0, 268*curProgress, 40);
|
|
|
+
|
|
|
+ NSString *butNewTitleStr = [[NSString alloc] initWithFormat:@"%@%ld%%",NSLocalizedString(@"image_version_Update_ing",nil),(NSInteger)curProgress*100];
|
|
|
+ [_updateNowBut setTitle:butNewTitleStr forState:UIControlStateNormal];
|
|
|
+
|
|
|
+
|
|
|
+ NSString *leftStr = NSLocalizedString(@"image_version_pop_144_tip2_1",nil);
|
|
|
+ NSString *rightStr = NSLocalizedString(@"image_version_pop_144_tip2_2",nil);
|
|
|
+
|
|
|
+ NSString *totalStr = [[NSString alloc] initWithFormat:@"%@%@",leftStr,rightStr];
|
|
|
+
|
|
|
+ NSMutableAttributedString *noteStr = [[NSMutableAttributedString alloc] initWithString:totalStr];
|
|
|
+
|
|
|
+ NSRange redRange = NSMakeRange([totalStr rangeOfString:rightStr].location, [totalStr rangeOfString:rightStr].length);
|
|
|
+ [noteStr addAttribute:NSForegroundColorAttributeName value:[UIColor hwColor:@"#FF2828" alpha:1.0] range:redRange];
|
|
|
+ //[noteStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:15.0] range:redRange];
|
|
|
+ // 设置行间距
|
|
|
+ NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
|
|
|
+ [paragraphStyle setLineSpacing:5]; //设置行间距
|
|
|
+
|
|
|
+ [noteStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [totalStr length])];
|
|
|
+
|
|
|
+ _tip1Lab.attributedText = noteStr;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@end
|