GuideViewController.m 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. //
  2. // GuideViewController.m
  3. // 双子星云手机
  4. //
  5. // Created by APPLE on 2023/8/11.
  6. //
  7. #import "GuideViewController.h"
  8. #import "Masonry.h"
  9. #import "UIView+View.h"
  10. #import "GuideView.h"
  11. #import "GuideLastView.h"
  12. #import "SetPWDFirstViewController.h"
  13. @interface GuideViewController ()
  14. {
  15. UIScrollView *bgScrView;
  16. GuideView *guideView0;
  17. GuideView *guideView1;
  18. GuideView *guideView2;
  19. GuideView *guideView3;
  20. GuideLastView *guideLastView;
  21. }
  22. @end
  23. @implementation GuideViewController
  24. @synthesize delegate;
  25. @synthesize sn;
  26. - (void)viewDidLoad {
  27. [super viewDidLoad];
  28. // Do any additional setup after loading the view.
  29. [self drawAnyView];
  30. }
  31. - (void)viewDidAppear:(BOOL)animated{
  32. [super viewDidAppear:animated];
  33. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  34. [self startMoveView];
  35. });
  36. }
  37. - (void)startMoveView{
  38. CGFloat x = bgScrView.contentOffset.x;
  39. NSInteger index = (x+1)/self.view.width;
  40. if (index == 4){
  41. /*记录已经用户引导*/
  42. [HWDataManager setBoolWithKey:Const_Have_Show_Guide value:YES];
  43. /*设置密码*/
  44. SetPWDFirstViewController *nextVC = [[SetPWDFirstViewController alloc] init];
  45. [self.navigationController pushViewController:nextVC animated:YES];
  46. }else{
  47. [bgScrView setContentOffset:CGPointMake((index + 1)*self.view.width, 0) animated:YES];
  48. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  49. [self startMoveView];
  50. });
  51. }
  52. }
  53. - (void)drawAnyView{
  54. [self.view setBackgroundColor:HWF5F7FAColor];
  55. bgScrView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, self.view.height)];
  56. [bgScrView setBackgroundColor:HWF5F7FAColor];
  57. [bgScrView setShowsVerticalScrollIndicator:NO];
  58. [bgScrView setShowsHorizontalScrollIndicator:NO];
  59. [bgScrView setPagingEnabled:YES];
  60. [bgScrView setUserInteractionEnabled:NO];
  61. [bgScrView setContentSize:CGSizeMake(5*self.view.width,self.view.height)];
  62. [bgScrView setClipsToBounds:YES];
  63. [self.view addSubview:bgScrView];
  64. guideView0 = [[GuideView alloc] initWithTips:NSLocalizedString(@"guide_middle_tips_0",nil)
  65. imageName:@"guide_middle_0_icon"
  66. index:0];
  67. guideView1 = [[GuideView alloc] initWithTips:NSLocalizedString(@"guide_middle_tips_1",nil)
  68. imageName:@"guide_middle_1_icon"
  69. index:1];
  70. guideView2 = [[GuideView alloc] initWithTips:NSLocalizedString(@"guide_middle_tips_2",nil)
  71. imageName:@"guide_middle_2_icon"
  72. index:2];
  73. guideView3 = [[GuideView alloc] initWithTips:NSLocalizedString(@"guide_middle_tips_3",nil)
  74. imageName:@"guide_middle_3_icon"
  75. index:3];
  76. guideView0.frame = CGRectMake(0*self.view.width, 0, self.view.width,self.view.height);
  77. guideView1.frame = CGRectMake(1*self.view.width, 0, self.view.width,self.view.height);
  78. guideView2.frame = CGRectMake(2*self.view.width, 0, self.view.width,self.view.height);
  79. guideView3.frame = CGRectMake(3*self.view.width, 0, self.view.width,self.view.height);
  80. [bgScrView addSubview:guideView0];
  81. [bgScrView addSubview:guideView1];
  82. [bgScrView addSubview:guideView2];
  83. [bgScrView addSubview:guideView3];
  84. guideLastView = [[GuideLastView alloc] initWithFrame:CGRectMake(4*self.view.width, 0, self.view.width,self.view.height)];
  85. [bgScrView addSubview:guideLastView];
  86. }
  87. /*
  88. #pragma mark - Navigation
  89. // In a storyboard-based application, you will often want to do a little preparation before navigation
  90. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  91. // Get the new view controller using [segue destinationViewController].
  92. // Pass the selected object to the new view controller.
  93. }
  94. */
  95. @end