GuideViewController.m 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. #import "connectDeviceManager.h"
  14. #import "inputPWDViewController.h"
  15. @interface GuideViewController ()
  16. {
  17. UIScrollView *bgScrView;
  18. GuideView *guideView0;
  19. GuideView *guideView1;
  20. GuideView *guideView2;
  21. GuideView *guideView3;
  22. GuideLastView *guideLastView;
  23. }
  24. @end
  25. @implementation GuideViewController
  26. @synthesize delegate;
  27. @synthesize sn;
  28. - (void)viewDidLoad {
  29. [super viewDidLoad];
  30. // Do any additional setup after loading the view.
  31. [self drawAnyView];
  32. if([[connectDeviceManager shareInstance] curConnectDeviceState] == DeviceConnectUnknown){
  33. [[connectDeviceManager shareInstance] getThridMsgBySN:sn didNetEnd:^(bool didSuc) {
  34. }];
  35. }
  36. }
  37. - (void)viewDidAppear:(BOOL)animated{
  38. [super viewDidAppear:animated];
  39. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  40. [self startMoveView];
  41. });
  42. }
  43. - (void)startMoveView{
  44. CGFloat x = bgScrView.contentOffset.x;
  45. NSInteger index = (x+1)/self.view.width;
  46. if (index == 4){
  47. /*记录已经用户引导*/
  48. [HWDataManager setBoolWithKey:Const_Have_Show_Guide value:YES];
  49. //是否已经有密码了 有就是输入密码 没有就是设置密码
  50. NSString *curPwd = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.password;
  51. if(curPwd && curPwd.length > 0){
  52. /*设置密码*/
  53. inputPWDViewController *nextVC = [[inputPWDViewController alloc] init];
  54. nextVC.isQRCodeType = YES;
  55. [self.navigationController pushViewController:nextVC animated:YES];
  56. }
  57. else{
  58. /*设置密码*/
  59. SetPWDFirstViewController *nextVC = [[SetPWDFirstViewController alloc] init];
  60. [self.navigationController pushViewController:nextVC animated:YES];
  61. }
  62. }else{
  63. [bgScrView setContentOffset:CGPointMake((index + 1)*self.view.width, 0) animated:YES];
  64. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  65. [self startMoveView];
  66. });
  67. }
  68. }
  69. - (void)drawAnyView{
  70. [self.view setBackgroundColor:HWF5F7FAColor];
  71. bgScrView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, self.view.height)];
  72. [bgScrView setBackgroundColor:HWF5F7FAColor];
  73. [bgScrView setShowsVerticalScrollIndicator:NO];
  74. [bgScrView setShowsHorizontalScrollIndicator:NO];
  75. [bgScrView setPagingEnabled:YES];
  76. [bgScrView setUserInteractionEnabled:NO];
  77. [bgScrView setContentSize:CGSizeMake(5*self.view.width,self.view.height)];
  78. [bgScrView setClipsToBounds:YES];
  79. [self.view addSubview:bgScrView];
  80. guideView0 = [[GuideView alloc] initWithTips:NSLocalizedString(@"guide_middle_tips_0",nil)
  81. imageName:@"guide_middle_0_icon"
  82. index:0];
  83. guideView1 = [[GuideView alloc] initWithTips:NSLocalizedString(@"guide_middle_tips_1",nil)
  84. imageName:@"guide_middle_1_icon"
  85. index:1];
  86. guideView2 = [[GuideView alloc] initWithTips:NSLocalizedString(@"guide_middle_tips_2",nil)
  87. imageName:@"guide_middle_2_icon"
  88. index:2];
  89. guideView3 = [[GuideView alloc] initWithTips:NSLocalizedString(@"guide_middle_tips_3",nil)
  90. imageName:@"guide_middle_3_icon"
  91. index:3];
  92. guideView0.frame = CGRectMake(0*self.view.width, 0, self.view.width,self.view.height);
  93. guideView1.frame = CGRectMake(1*self.view.width, 0, self.view.width,self.view.height);
  94. guideView2.frame = CGRectMake(2*self.view.width, 0, self.view.width,self.view.height);
  95. guideView3.frame = CGRectMake(3*self.view.width, 0, self.view.width,self.view.height);
  96. [bgScrView addSubview:guideView0];
  97. [bgScrView addSubview:guideView1];
  98. [bgScrView addSubview:guideView2];
  99. [bgScrView addSubview:guideView3];
  100. guideLastView = [[GuideLastView alloc] initWithFrame:CGRectMake(4*self.view.width, 0, self.view.width,self.view.height)];
  101. [bgScrView addSubview:guideLastView];
  102. }
  103. @end