Onboard,迷人的引导页样式制作库
2015-11-24 17:43
525 查看
简介
Onboard主要用于引导页制作,源码写的相当规范,值得参考.
项目主页: https://github.com/mamaral/Onboard
实例下载: https://github.com/mamaral/Onboard/archive/master.zip
样式
设置背景图片或者背景movie,然后在它们之上生成数个ViewController,默认是顶部一张图片,下面是标题和详细介绍,最下面是按钮和page导入
pod 'Onboard'
使用
导入头文件#import "OnboardingViewController.h"图片为背景
蒙板控制器生成方法
title是标题body是介绍
image是顶部图片
buttonText是按钮文本
block是按钮点击事件
```objc
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 任务池
相关文章推荐
- css媒体查询判断横屏、竖屏
- css动画效果transtion,transform,animation
- 详解CSS3选择器的使用方法汇总
- CSS - DIV标签width根据内容自适应
- css规范
- 使用CSS为内容设定特定的鼠标样式(cursor)介绍
- 深入浅析css3 border-image边框图像详解
- 南大软院大神养成计划——CSS进阶
- CSS优先级详解
- sublimeText3中 less2css error: `lessc` is not available的解决办法
- 修改checkbox的样式
- CSS(3)
- CSS基础知识真难啊-position-relative-absolute
- CSS学习<5>
- CSS3打造不断旋转的CD封面
- CSS3打造不断旋转的CD封面
- CSS 初识
- css的书写规范,有哪些注意点
- 使用css3画饼图
- CSS书写规范