• 应用引导页配置相关 - 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. }

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

  • 相关阅读:
    Ansible基础及模块
    ElasticSearch从入门到精通(一)
    AI视频教程下载-1小时ChatGPT提示基础课程
    如何使用jenkins、ant、selenium、testng搭建自动化测试框架
    硬盘分区基础
    Windows bat脚本启动jar包(亲测有效),,监控端口,如果没有,就启动jar包,自动退出cmd框
    蓝桥杯备赛第五篇(动态规划)
    07_面向对象高级_内部类
    这也能造成故障?我只给DTO类加了一个属性
    解锁小鹏G9的隐藏功能
  • 原文地址:https://blog.csdn.net/survivorsfyh/article/details/136390856