美文网首页iOS
应用引导页配置相关 - iOS

应用引导页配置相关 - iOS

作者: survivorsfyh | 来源:发表于2024-02-29 11:18 被阅读0次

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

/**
 加载引导页
 */
- (void)loadGuidePage {
    // 基础配置
    self.window = [[UIWindow alloc] initWithFrame:SCREEN_RECT];
    self.window.backgroundColor = [UIColor whiteColor];
    
    viewController = [[UIViewController alloc] init];
    viewController.view.frame = self.window.bounds;
    viewController.view.backgroundColor = [UIColor whiteColor]; // [UIColor generateDynamicColor:[UIColor whiteColor] darkColor:[UIColor blackColor]];
    self.window.rootViewController = viewController;
    [self.window makeKeyAndVisible];
    
    // 数据源
    NSArray *arrGuidePage = @[@"guidePageFirst", @"guidePageSecond", @"guidePageThird"]; // , @"guidePageFourth"
    // 组件初始化
    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:viewController.view.bounds];
    scrollView.backgroundColor = [UIColor lightGrayColor];
    scrollView.delegate = self;
    scrollView.contentSize = CGSizeMake(arrGuidePage.count * SCREEN_WIDTH, self.window.frame.size.height);
    scrollView.pagingEnabled = YES;
    scrollView.showsHorizontalScrollIndicator = NO;
    scrollView.showsVerticalScrollIndicator = NO;
    [viewController.view addSubview:scrollView];
    // 组件设置
    for (NSInteger i = 0; i < arrGuidePage.count; i++) {
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(i * SCREEN_WIDTH, 0, SCREEN_WIDTH, SCREENH_HEIGHT)]; // self.window.frame.size.height
        imageView.userInteractionEnabled = YES;
        imageView.image = [[UIImage imageNamed:[NSString stringWithFormat:@"%@", arrGuidePage[i]]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        [scrollView addSubview:imageView];
        
        if (i == arrGuidePage.count - 1) {
            UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
            btn.frame = CGRectMake(i * SCREEN_WIDTH + 30, SCREEN_HEIGHT - 120, SCREEN_WIDTH - 30 * 2, 50);
            btn.backgroundColor = [UIColor colorWithHexString:@"#ff685e"];
            [btn setTitle:@"立即体验" forState:UIControlStateNormal];
            [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
            btn.layer.cornerRadius = 4.f;
            btn.layer.masksToBounds = YES;
            btn.layer.borderWidth = 1;
            btn.layer.borderColor = [UIColor colorWithHexString:@"#ff685e"].CGColor;
            btn.alpha = 0;
            [UIView animateWithDuration:3.f animations:^{
                btn.alpha = 1;
            }];
            [btn addTarget:self action:@selector(pushHomePage) forControlEvents:UIControlEventTouchUpInside];
            [scrollView addSubview:btn];
        }
    }
}

- (void)pushHomePage {

}

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

相关文章

  • iOS1

    随着 iOS10的推出,iOS应用需要做相关的配置: 1:如果你的App想要...

  • 关于iOS应用启动页与引导页的显示切换

    我们在移动应用开发中经常会应用到启动页与引导页,为了实现启动页与引导页,以及应用功能界面的无缝连接,今天我...

  • ios引导页

    首先修改 App Transport Security SettingsAllow Arbitrary Loads...

  • iOS 引导页

    在AppDelegate.m中:我们需要两个Viewcongtroller来实现;myViewController...

  • ios 引导页

    目标功能 能够快速实现普通引导页功能. 提供自定义view的加载模式. 提供特定样式的加载模式,只需要配置即可. ...

  • iOS引导页

    在我们项目中经常会用到引导页,引导页主要功能就是向用户展示你的产品。 这是我写的一个例子的效果图(图片是随便找的):

  • iOS引导页

    引导页是App中的基本功能,指导用户理解某些操作或版本变化等等。 引导页可能出现在任何时候,页面内容会根据可交互度...

  • iOS 应用首次启动引导页功能

    预览图: 实现思路: 先判断应用是不是第一次启动, 这个可以再AppDelegate的启动方法didFinishL...

  • iOS应用跳转到appstore评分

    iOS应用跳转到appstore评分 标签(空格分隔): IOS 跳转到应用评价页 跳转到应用详情页 appid是...

  • Xamarin.iOS 引导页(UICollectionView

    本文主要讲解使用UICollectionView来完成应用引导页的实现 应用引导页在项目中的使用还是比较频繁的,一...

网友评论

    本文标题:应用引导页配置相关 - iOS

    本文链接:https://www.haomeiwen.com/subject/uzcqzdtx.html