zoukankan      html  css  js  c++  java
  • Onboard,迷人的引导页样式制作库

    简介

    Onboard主要用于引导页制作,源码写的相当规范,值得参考.

    样式

    设置背景图片或者背景movie,然后在它们之上生成数个ViewController,默认是顶部一张图片,下面是标题和详细介绍,最下面是按钮和page

    导入

    pod 'Onboard'
    

    使用

    • 导入头文件#import "OnboardingViewController.h"

    图片为背景

    蒙板控制器生成方法

    • title是标题
    • body是介绍
    • image是顶部图片
    • buttonText是按钮文本
    • block是按钮点击事件
    OnboardingContentViewController *firstPage = [OnboardingContentViewController contentWithTitle:@"What A Beautiful Photo" body:@"This city background image is so beautiful." image:[UIImage imageNamed:@"blue"] buttonText:@"Enable Location Services" action:^{
    }];
        
    OnboardingContentViewController *secondPage = [OnboardingContentViewController contentWithTitle:@"I'm so sorry" body:@"I can't get over the nice blurry background photo." image:[UIImage imageNamed:@"red"] buttonText:@"Connect With Facebook" action:^{
    }];       
    secondPage.movesToNextViewController = YES;
    secondPage.viewDidAppearBlock = ^{
    };
        
    OnboardingContentViewController *thirdPage = [OnboardingContentViewController contentWithTitle:@"Seriously Though" body:@"Kudos to the photographer." image:[UIImage imageNamed:@"yellow"] buttonText:@"Get Started" action:^{
    }];
    

    底部图片控制器

    	OnboardingViewController *onboardingVC = [OnboardingViewController onboardWithBackgroundImage:[UIImage imageNamed:@"milky_way.jpg"] contents:@[firstPage, secondPage, thirdPage]];
    

    底部video控制器

    	NSBundle *bundle = [NSBundle mainBundle];
    	NSString *moviePath = [bundle pathForResource:@"yourVid" ofType:@"mp4"];
    	NSURL *movieURL = [NSURL fileURLWithPath:moviePath];
    	OnboardingViewController *onboardingVC = [OnboardingViewController onboardWithBackgroundVideoURL:movieURL contents:@[firstPage, secondPage, thirdPage]];
    

    定制

    • 默认的会给背景图片或者movie加一层黑色的蒙板,可以去掉它们:
    	onboardingVC.shouldFadeTransitions = YES;
    
    • 可以给图片加上模糊效果(相当漂亮):
    	onboardingVC.shouldBlurBackground = YES;
    
    • 可以给蒙板上的文字加上淡出效果:
    	onboardingVC.shouldFadeTransitions = YES;
    

    注: 文章由我们 iOS122 的小伙伴 @酌晨茗 整理,喜欢就一起参与: iOS122 任务池

  • 相关阅读:
    spring bean的三种管理方式·
    mybatis解决字段名和实体属性不相同
    python字符串格式化方法%s和format函数
    myeclipse配置springmvc教程
    2019ICPC南昌站
    浅谈可持久化线段树(主席树)
    2019CCPC厦门站总结
    牛客练习赛53 E-老瞎眼pk小鲜肉(思维+线段树+离线)
    2019牛客暑期多校训练营(第一场)A
    [The Preliminary Contest for ICPC Asia Nanjing 2019] L-Digit sum
  • 原文地址:https://www.cnblogs.com/ios122/p/4992322.html
Copyright © 2011-2022 走看看