Browse Source

1.启动页加跳过

huangxiaodong 1 year ago
parent
commit
bdbd88606b

+ 2 - 0
创维盒子/双子星云手机/Class/Guide/GuideView.h

@@ -23,6 +23,8 @@ NS_ASSUME_NONNULL_BEGIN
  */
 - (id)initWithTips:(NSString *)tips imageName:(NSString *)imageName index:(NSInteger)index;
 
+//点击了跳过
+@property (nonatomic,copy) void (^didClickButton)(void);
 @end
 
 NS_ASSUME_NONNULL_END

+ 28 - 0
创维盒子/双子星云手机/Class/Guide/GuideView.m

@@ -55,6 +55,27 @@
         make.height.mas_equalTo(28);
     }];
     
+    /*跳过*/
+    bgImageView.userInteractionEnabled = YES;
+    UIButton *skipBtn = [[UIButton alloc] init];
+    [skipBtn addTarget:self action:@selector(didClickButFun:) forControlEvents:(UIControlEventTouchUpInside)];
+    [skipBtn setTitle:NSLocalizedString(@"guide_skip",nil) forState:(UIControlStateNormal)];
+    //[skipBtn setTitleColor:HW999999Color forState:(UIControlStateNormal)];
+    [skipBtn.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
+    [skipBtn.layer setCornerRadius:14.f];
+    skipBtn.layer.borderColor = [UIColor whiteColor].CGColor;
+    skipBtn.layer.borderWidth = 1.0;
+    //[skipBtn setBackgroundColor:HWE3E8F1Color];
+    skipBtn.clipsToBounds = YES;
+    [self addSubview:skipBtn];
+    [skipBtn mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.right.mas_equalTo(-20);
+        make.width.mas_equalTo(80.f);
+        make.top.equalTo(upImageView.mas_top).offset(0.f);
+        make.height.mas_equalTo(28.f);
+    }];
+    
+    
     /*左头部标签*/
     UILabel *topLeftLabel = [[UILabel alloc] init];
     [topLeftLabel setFont:[UIFont boldSystemFontOfSize:30]];
@@ -165,4 +186,11 @@
     }];
 }
 
+#pragma mark 点击按钮
+-(void)didClickButFun:(UIButton*)but
+{
+    if(_didClickButton){
+        _didClickButton();
+    }
+}
 @end

+ 35 - 3
创维盒子/双子星云手机/Class/Guide/GuideViewController.m

@@ -14,7 +14,7 @@
 #import "connectDeviceManager.h"
 #import "inputPWDViewController.h"
 
-@interface GuideViewController ()
+@interface GuideViewController ()<UIScrollViewDelegate>
 {
     UIScrollView *bgScrView;
     GuideView *guideView0;
@@ -52,6 +52,7 @@
 }
 
 - (void)startMoveView{
+
     CGFloat x = bgScrView.contentOffset.x;
     NSInteger index = (x+1)/self.view.width;
     if (index == 4){
@@ -111,7 +112,8 @@
     [bgScrView setShowsVerticalScrollIndicator:NO];
     [bgScrView setShowsHorizontalScrollIndicator:NO];
     [bgScrView setPagingEnabled:YES];
-    [bgScrView setUserInteractionEnabled:NO];
+//    [bgScrView setUserInteractionEnabled:NO];
+    bgScrView.delegate = self;
     [bgScrView setContentSize:CGSizeMake(5*self.view.width,self.view.height)];
     [bgScrView setClipsToBounds:YES];
     [self.view addSubview:bgScrView];
@@ -141,8 +143,38 @@
     
     guideLastView = [[GuideLastView alloc] initWithFrame:CGRectMake(4*self.view.width, 0, self.view.width,self.view.height)];
     [bgScrView addSubview:guideLastView];
+    
+    KWeakSelf
+    guideView0.didClickButton = ^{
+        [weakSelf didClickSkipFun];
+    };
+    
+    guideView1.didClickButton = ^{
+        [weakSelf didClickSkipFun];
+    };
+    
+    guideView2.didClickButton = ^{
+        [weakSelf didClickSkipFun];
+    };
+    
+    guideView3.didClickButton = ^{
+        [weakSelf didClickSkipFun];
+    };
 }
 
+#pragma mark 点击了跳过
+- (void)didClickSkipFun
+{
+    [bgScrView setContentOffset:CGPointMake(4*self.view.width, 0) animated:NO];
+}
 
-
+#pragma mark 监听滚动
+- (void)scrollViewDidScroll:(UIScrollView *)scrollView
+{
+    CGFloat x = scrollView.contentOffset.x;
+    NSInteger index = (x+1)/self.view.width;
+    if (index == 4){
+        bgScrView.userInteractionEnabled = NO;
+    }
+}
 @end

+ 1 - 0
创维盒子/双子星云手机/en.lproj/Localizable.strings

@@ -187,6 +187,7 @@
 "my_set_TVP2P_Open_sure" = "sure";
 
 "guide_welcome" = "welcome";
+"guide_skip" = "skip";
 "guide_set_sys_value" = "We are configuring the system environment for you...";
 "guide_middle_tips_0" = "Main system and Private-X system are completely independent, software runs in isolation, ensuring data privacy.";
 "guide_middle_tips_1" = "Private-X separates work and life, promoting a more balanced lifestyle.";

+ 1 - 0
创维盒子/双子星云手机/zh-Hans.lproj/Localizable.strings

@@ -186,6 +186,7 @@
 "my_set_TVP2P_Open_sure" = "确定";
 
 "guide_welcome" = "欢迎使用";
+"guide_skip" = "跳过";
 "guide_set_sys_value" = "我们正在为您配置系统环境...";
 "guide_middle_tips_0" = "主系统与Private-x系统完全独立\n软件隔离运行,确保数据隐私";
 "guide_middle_tips_1" = "Private-x将工作与生活分开\n成就更加平衡的生活方式";

+ 1 - 0
创维盒子/双子星云手机/zh-Hant.lproj/Localizable.strings

@@ -186,6 +186,7 @@
 "my_set_TVP2P_Open_sure" = "確定";
 
 "guide_welcome" = "歡迎使用";
+"guide_skip" = "跳過";
 "guide_set_sys_value" = "我們正在為您配置系統環境...";
 "guide_middle_tips_0" = "主系統與Private-x系統完全獨立\n軟件隔離運行,確保數據隱私";
 "guide_middle_tips_1" = "Private-x將工作與生活分開\n成就更加平衡的生活方式";