• 应用引导页配置相关 - iOS


    应用引导页配置相关,通过 ScrollView 滑动至末页点击进入主页,具体实现方式如下,可供参考;

    1. /**
    2. 加载引导页
    3. */
    4. - (void)loadGuidePage {
    5. // 基础配置
    6. self.window = [[UIWindow alloc] initWithFrame:SCREEN_RECT];
    7. self.window.backgroundColor = [UIColor whiteColor];
    8. viewController = [[UIViewController alloc] init];
    9. viewController.view.frame = self.window.bounds;
    10. viewController.view.backgroundColor = [UIColor whiteColor]; // [UIColor generateDynamicColor:[UIColor whiteColor] darkColor:[UIColor blackColor]];
    11. self.window.rootViewController = viewController;
    12. [self.window makeKeyAndVisible];
    13. // 数据源
    14. NSArray *arrGuidePage = @[@"guidePageFirst", @"guidePageSecond", @"guidePageThird"]; // , @"guidePageFourth"
    15. // 组件初始化
    16. UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:viewController.view.bounds];
    17. scrollView.backgroundColor = [UIColor lightGrayColor];
    18. scrollView.delegate = self;
    19. scrollView.contentSize = CGSizeMake(arrGuidePage.count * SCREEN_WIDTH, self.window.frame.size.height);
    20. scrollView.pagingEnabled = YES;
    21. scrollView.showsHorizontalScrollIndicator = NO;
    22. scrollView.showsVerticalScrollIndicator = NO;
    23. [viewController.view addSubview:scrollView];
    24. // 组件设置
    25. for (NSInteger i = 0; i < arrGuidePage.count; i++) {
    26. UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(i * SCREEN_WIDTH, 0, SCREEN_WIDTH, SCREENH_HEIGHT)]; // self.window.frame.size.height
    27. imageView.userInteractionEnabled = YES;
    28. imageView.image = [[UIImage imageNamed:[NSString stringWithFormat:@"%@", arrGuidePage[i]]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    29. [scrollView addSubview:imageView];
    30. if (i == arrGuidePage.count - 1) {
    31. UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    32. btn.frame = CGRectMake(i * SCREEN_WIDTH + 30, SCREEN_HEIGHT - 120, SCREEN_WIDTH - 30 * 2, 50);
    33. btn.backgroundColor = [UIColor colorWithHexString:@"#ff685e"];
    34. [btn setTitle:@"立即体验" forState:UIControlStateNormal];
    35. [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    36. btn.layer.cornerRadius = 4.f;
    37. btn.layer.masksToBounds = YES;
    38. btn.layer.borderWidth = 1;
    39. btn.layer.borderColor = [UIColor colorWithHexString:@"#ff685e"].CGColor;
    40. btn.alpha = 0;
    41. [UIView animateWithDuration:3.f animations:^{
    42. btn.alpha = 1;
    43. }];
    44. [btn addTarget:self action:@selector(pushHomePage) forControlEvents:UIControlEventTouchUpInside];
    45. [scrollView addSubview:btn];
    46. }
    47. }
    48. }
    49. - (void)pushHomePage {
    50. }

    以上便是此次分享的全部内容,希望能对大家有所帮助!

  • 相关阅读:
    Mybatis-Plus
    HTML5期末考核大作业 基于HTML+CSS+JavaScript沪上美食(9页)
    自动化RPA大纲
    数据结构学习系列之顺序表的两种删除方式
    如何使用API进行大规模数据收集和分析
    http请求头中的Content-Type到底有什么用?
    postman登录鉴权之接口测试
    【ESP32_8266_MQTT篇】
    2-3 社交网络图中结点的“重要性”计算
    Android Studio 利用系统签名打包apk
  • 原文地址:https://blog.csdn.net/survivorsfyh/article/details/136390856