|
|
@@ -28,73 +28,173 @@
|
|
|
[self.navigationBar setHidden:YES];
|
|
|
[self.toolBar setHidden:YES];
|
|
|
|
|
|
+ [self initBaseUIFun];
|
|
|
+
|
|
|
/*背景视图*/
|
|
|
- UIImageView *bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"guide_qrcode_bg_icon"]];
|
|
|
- [bgImageView setContentMode:(UIViewContentModeScaleToFill)];
|
|
|
- [self.view addSubview:bgImageView];
|
|
|
- [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.top.mas_equalTo(0);
|
|
|
- make.bottom.mas_equalTo(0);
|
|
|
+// UIImageView *bgImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"guide_qrcode_bg_icon"]];
|
|
|
+// [bgImageView setContentMode:(UIViewContentModeScaleToFill)];
|
|
|
+// [self.view addSubview:bgImageView];
|
|
|
+// [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+// make.top.mas_equalTo(0);
|
|
|
+// make.bottom.mas_equalTo(0);
|
|
|
+// make.left.mas_equalTo(0);
|
|
|
+// make.right.mas_equalTo(0);
|
|
|
+// }];
|
|
|
+//
|
|
|
+// UIButton *qrcodeBtn = [[UIButton alloc] init];
|
|
|
+// [qrcodeBtn setBackgroundColor:[UIColor clearColor]];
|
|
|
+// [qrcodeBtn setBackgroundImage:[UIImage imageNamed:@"guide_qrcode_icon"] forState:(UIControlStateNormal)];
|
|
|
+// [self.view addSubview:qrcodeBtn];
|
|
|
+// [qrcodeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+// make.top.mas_equalTo((363.f/812.f)*self.view.height - 80.f);
|
|
|
+// make.centerX.equalTo(self.view.mas_centerX);
|
|
|
+// make.width.mas_equalTo(160);
|
|
|
+// make.height.mas_equalTo(160);
|
|
|
+// }];
|
|
|
+//
|
|
|
+// [qrcodeBtn addTarget:self
|
|
|
+// action:@selector(qrcodeBtnPressed)
|
|
|
+// forControlEvents:(UIControlEventTouchUpInside)];
|
|
|
+//
|
|
|
+// /*提示文字*/
|
|
|
+// UILabel *tipsLabel = [[UILabel alloc] init];
|
|
|
+// [tipsLabel setFont:[UIFont systemFontOfSize:14]];
|
|
|
+// [tipsLabel setTextColor:HW666666Color];
|
|
|
+// [tipsLabel setTextAlignment:(NSTextAlignmentCenter)];
|
|
|
+// [self.view addSubview:tipsLabel];
|
|
|
+// [tipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+// make.top.equalTo(qrcodeBtn.mas_bottom).offset(8);
|
|
|
+// make.left.mas_equalTo(60);
|
|
|
+// make.right.mas_equalTo(-60);
|
|
|
+// }];
|
|
|
+// [tipsLabel setText:NSLocalizedString(@"guide_qrcoede_tips",nil)];
|
|
|
+//
|
|
|
+// /*扫一扫按钮*/
|
|
|
+// UIButton *qrcodeSmallBtn = [[UIButton alloc] init];
|
|
|
+// qrcodeSmallBtn.frame = CGRectMake(0, 0, 120.f, 36.f);
|
|
|
+//
|
|
|
+// // gradient
|
|
|
+// CAGradientLayer *gl = [CAGradientLayer layer];
|
|
|
+// gl.frame = CGRectMake(0,0,120.f,36.f);
|
|
|
+// gl.startPoint = CGPointMake(0, 0.5);
|
|
|
+// gl.endPoint = CGPointMake(1, 0.5);
|
|
|
+// gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
|
|
|
+// gl.locations = @[@(0), @(1.0f)];
|
|
|
+//
|
|
|
+// [qrcodeSmallBtn.layer addSublayer:gl];
|
|
|
+// [qrcodeSmallBtn addTarget:self action:@selector(qrcodeBtnPressed) forControlEvents:(UIControlEventTouchUpInside)];
|
|
|
+// [qrcodeSmallBtn setTitle:NSLocalizedString(@"guide_qrcoede_btn_title",nil) forState:(UIControlStateNormal)];
|
|
|
+// [qrcodeSmallBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
|
|
|
+// [qrcodeSmallBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
|
|
|
+// [qrcodeSmallBtn.layer setCornerRadius:18.f];
|
|
|
+// qrcodeSmallBtn.clipsToBounds = YES;
|
|
|
+// [self.view addSubview:qrcodeSmallBtn];
|
|
|
+// [qrcodeSmallBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+// make.centerX.equalTo(self.view.mas_centerX);
|
|
|
+// make.width.mas_equalTo(120.f);
|
|
|
+// make.top.equalTo(tipsLabel.mas_bottom).offset(20);
|
|
|
+// make.height.mas_equalTo(36.f);
|
|
|
+// }];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)initBaseUIFun
|
|
|
+{
|
|
|
+ self.view.backgroundColor = [UIColor whiteColor];
|
|
|
+
|
|
|
+ NSString *curTitleStr = NSLocalizedString(@"scan_Tip_title",nil);
|
|
|
+
|
|
|
+ /*标题*/
|
|
|
+ UILabel *titleLabel = [[UILabel alloc] init];
|
|
|
+ [titleLabel setFont:[UIFont systemFontOfSize:18]];
|
|
|
+ [titleLabel setTextColor:HW333333Color];
|
|
|
+ [titleLabel setTextAlignment:(NSTextAlignmentCenter)];
|
|
|
+ [self.view addSubview:titleLabel];
|
|
|
+ [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(self.titleLabel.mas_top).offset(0);
|
|
|
+ make.left.mas_equalTo(10);
|
|
|
+ make.right.mas_equalTo(-10);
|
|
|
+ make.height.mas_equalTo(25.0);
|
|
|
+ }];
|
|
|
+ [titleLabel setText:curTitleStr];
|
|
|
+
|
|
|
+ //
|
|
|
+ UIScrollView *bgScorllV = [[UIScrollView alloc] init];
|
|
|
+ bgScorllV.showsHorizontalScrollIndicator = NO;
|
|
|
+ //bgScorllV.backgroundColor = [UIColor redColor];
|
|
|
+ [self.view addSubview:bgScorllV];
|
|
|
+
|
|
|
+ [bgScorllV mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(self.titleLabel.mas_bottom).offset(30);
|
|
|
make.left.mas_equalTo(0);
|
|
|
make.right.mas_equalTo(0);
|
|
|
+ make.bottom.mas_equalTo(-100.0);
|
|
|
}];
|
|
|
+
|
|
|
+ NSString *languageCode = [NSLocale preferredLanguages][0];
|
|
|
+
|
|
|
+ NSString *imageNameStr = @"scan_tip_en";
|
|
|
+ CGFloat imageW = 345.0;
|
|
|
+ CGFloat imageH = 598.0;
|
|
|
|
|
|
- UIButton *qrcodeBtn = [[UIButton alloc] init];
|
|
|
- [qrcodeBtn setBackgroundColor:[UIColor clearColor]];
|
|
|
- [qrcodeBtn setBackgroundImage:[UIImage imageNamed:@"guide_qrcode_icon"] forState:(UIControlStateNormal)];
|
|
|
- [self.view addSubview:qrcodeBtn];
|
|
|
- [qrcodeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.top.mas_equalTo((363.f/812.f)*self.view.height - 80.f);
|
|
|
- make.centerX.equalTo(self.view.mas_centerX);
|
|
|
- make.width.mas_equalTo(160);
|
|
|
- make.height.mas_equalTo(160);
|
|
|
- }];
|
|
|
+ if([languageCode rangeOfString:@"zh-Hans"].location != NSNotFound)
|
|
|
+ {
|
|
|
+ imageNameStr = @"scan_tip_Hans";
|
|
|
+ }
|
|
|
+ else if([languageCode rangeOfString:@"zh-Hant"].location != NSNotFound)
|
|
|
+ {
|
|
|
+ imageNameStr = @"scan_tip_Hant";
|
|
|
+ }
|
|
|
+ else if([languageCode rangeOfString:@"ja-"].location != NSNotFound)
|
|
|
+ {
|
|
|
+ imageNameStr = @"scan_tip_ja";
|
|
|
+
|
|
|
+ imageH = 672.0;
|
|
|
+ }
|
|
|
|
|
|
- [qrcodeBtn addTarget:self
|
|
|
- action:@selector(qrcodeBtnPressed)
|
|
|
- forControlEvents:(UIControlEventTouchUpInside)];
|
|
|
|
|
|
- /*提示文字*/
|
|
|
- UILabel *tipsLabel = [[UILabel alloc] init];
|
|
|
- [tipsLabel setFont:[UIFont systemFontOfSize:14]];
|
|
|
- [tipsLabel setTextColor:HW666666Color];
|
|
|
- [tipsLabel setTextAlignment:(NSTextAlignmentCenter)];
|
|
|
- [self.view addSubview:tipsLabel];
|
|
|
- [tipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.top.equalTo(qrcodeBtn.mas_bottom).offset(8);
|
|
|
- make.left.mas_equalTo(60);
|
|
|
- make.right.mas_equalTo(-60);
|
|
|
+
|
|
|
+ UIImageView * bgImageV = [[UIImageView alloc] init];
|
|
|
+ bgImageV.image = [UIImage imageNamed:imageNameStr];
|
|
|
+ [bgScorllV addSubview:bgImageV];
|
|
|
+
|
|
|
+ [bgImageV mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.centerX.mas_equalTo(0);
|
|
|
+ make.top.mas_equalTo(0);
|
|
|
+ make.width.mas_equalTo(imageW);
|
|
|
+ make.height.mas_equalTo(imageH);
|
|
|
}];
|
|
|
- [tipsLabel setText:NSLocalizedString(@"guide_qrcoede_tips",nil)];
|
|
|
+
|
|
|
+ bgScorllV.contentSize = CGSizeMake(imageW, imageH);
|
|
|
+
|
|
|
|
|
|
/*扫一扫按钮*/
|
|
|
UIButton *qrcodeSmallBtn = [[UIButton alloc] init];
|
|
|
- qrcodeSmallBtn.frame = CGRectMake(0, 0, 120.f, 36.f);
|
|
|
-
|
|
|
+
|
|
|
// gradient
|
|
|
CAGradientLayer *gl = [CAGradientLayer layer];
|
|
|
- gl.frame = CGRectMake(0,0,120.f,36.f);
|
|
|
+ gl.frame = CGRectMake(0,0,345.f,48.f);
|
|
|
gl.startPoint = CGPointMake(0, 0.5);
|
|
|
gl.endPoint = CGPointMake(1, 0.5);
|
|
|
gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
|
|
|
gl.locations = @[@(0), @(1.0f)];
|
|
|
-
|
|
|
+
|
|
|
[qrcodeSmallBtn.layer addSublayer:gl];
|
|
|
[qrcodeSmallBtn addTarget:self action:@selector(qrcodeBtnPressed) forControlEvents:(UIControlEventTouchUpInside)];
|
|
|
- [qrcodeSmallBtn setTitle:NSLocalizedString(@"guide_qrcoede_btn_title",nil) forState:(UIControlStateNormal)];
|
|
|
+ [qrcodeSmallBtn setTitle:NSLocalizedString(@"scan_Tip_title_button",nil) forState:(UIControlStateNormal)];
|
|
|
[qrcodeSmallBtn setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
|
|
|
- [qrcodeSmallBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
|
|
|
- [qrcodeSmallBtn.layer setCornerRadius:18.f];
|
|
|
+ [qrcodeSmallBtn.titleLabel setFont:[UIFont systemFontOfSize:16.f]];
|
|
|
+ [qrcodeSmallBtn.layer setCornerRadius:8.f];
|
|
|
qrcodeSmallBtn.clipsToBounds = YES;
|
|
|
[self.view addSubview:qrcodeSmallBtn];
|
|
|
[qrcodeSmallBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.centerX.equalTo(self.view.mas_centerX);
|
|
|
- make.width.mas_equalTo(120.f);
|
|
|
- make.top.equalTo(tipsLabel.mas_bottom).offset(20);
|
|
|
- make.height.mas_equalTo(36.f);
|
|
|
+ make.width.mas_equalTo(345.f);
|
|
|
+ make.top.equalTo(bgScorllV.mas_bottom).offset(15);
|
|
|
+ make.height.mas_equalTo(48.f);
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
+
|
|
|
- (void)qrcodeBtnPressed{
|
|
|
QRCodeScanViewController *nextVC = [[QRCodeScanViewController alloc] init];
|
|
|
[self.navigationController pushViewController:nextVC animated:YES];
|