123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- //
- // GuideViewController.m
- // 双子星云手机
- //
- // Created by APPLE on 2023/8/11.
- //
- #import "GuideViewController.h"
- #import "Masonry.h"
- #import "UIView+View.h"
- #import "GuideView.h"
- #import "GuideLastView.h"
- #import "SetPWDFirstViewController.h"
- #import "connectDeviceManager.h"
- @interface GuideViewController ()
- {
- UIScrollView *bgScrView;
- GuideView *guideView0;
- GuideView *guideView1;
- GuideView *guideView2;
- GuideView *guideView3;
- GuideLastView *guideLastView;
- }
- @end
- @implementation GuideViewController
- @synthesize delegate;
- @synthesize sn;
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- [self drawAnyView];
-
-
- if([[connectDeviceManager shareInstance] curConnectDeviceState] == DeviceConnectUnknown){
- [[connectDeviceManager shareInstance] getThridMsgBySN:sn];
- }
- }
- - (void)viewDidAppear:(BOOL)animated{
- [super viewDidAppear:animated];
-
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [self startMoveView];
- });
- }
- - (void)startMoveView{
- CGFloat x = bgScrView.contentOffset.x;
- NSInteger index = (x+1)/self.view.width;
- if (index == 4){
- /*记录已经用户引导*/
- [HWDataManager setBoolWithKey:Const_Have_Show_Guide value:YES];
- /*设置密码*/
- SetPWDFirstViewController *nextVC = [[SetPWDFirstViewController alloc] init];
- [self.navigationController pushViewController:nextVC animated:YES];
- }else{
- [bgScrView setContentOffset:CGPointMake((index + 1)*self.view.width, 0) animated:YES];
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [self startMoveView];
- });
- }
- }
- - (void)drawAnyView{
- [self.view setBackgroundColor:HWF5F7FAColor];
-
- bgScrView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, self.view.height)];
- [bgScrView setBackgroundColor:HWF5F7FAColor];
- [bgScrView setShowsVerticalScrollIndicator:NO];
- [bgScrView setShowsHorizontalScrollIndicator:NO];
- [bgScrView setPagingEnabled:YES];
- [bgScrView setUserInteractionEnabled:NO];
- [bgScrView setContentSize:CGSizeMake(5*self.view.width,self.view.height)];
- [bgScrView setClipsToBounds:YES];
- [self.view addSubview:bgScrView];
-
- guideView0 = [[GuideView alloc] initWithTips:NSLocalizedString(@"guide_middle_tips_0",nil)
- imageName:@"guide_middle_0_icon"
- index:0];
- guideView1 = [[GuideView alloc] initWithTips:NSLocalizedString(@"guide_middle_tips_1",nil)
- imageName:@"guide_middle_1_icon"
- index:1];
- guideView2 = [[GuideView alloc] initWithTips:NSLocalizedString(@"guide_middle_tips_2",nil)
- imageName:@"guide_middle_2_icon"
- index:2];
- guideView3 = [[GuideView alloc] initWithTips:NSLocalizedString(@"guide_middle_tips_3",nil)
- imageName:@"guide_middle_3_icon"
- index:3];
-
- guideView0.frame = CGRectMake(0*self.view.width, 0, self.view.width,self.view.height);
- guideView1.frame = CGRectMake(1*self.view.width, 0, self.view.width,self.view.height);
- guideView2.frame = CGRectMake(2*self.view.width, 0, self.view.width,self.view.height);
- guideView3.frame = CGRectMake(3*self.view.width, 0, self.view.width,self.view.height);
-
- [bgScrView addSubview:guideView0];
- [bgScrView addSubview:guideView1];
- [bgScrView addSubview:guideView2];
- [bgScrView addSubview:guideView3];
-
- guideLastView = [[GuideLastView alloc] initWithFrame:CGRectMake(4*self.view.width, 0, self.view.width,self.view.height)];
- [bgScrView addSubview:guideLastView];
- }
- @end
|