// // 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" @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]; } - (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]; } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end