Onboard,迷人的引導頁樣式製做庫

簡介

Onboard主要用於引導頁製做,源碼寫的至關規範,值得參考.ios

樣式

設置背景圖片或者背景movie,而後在它們之上生成數個ViewController,默認是頂部一張圖片,下面是標題和詳細介紹,最下面是按鈕和pagegit

導入

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 任務池github

相關文章
相關標籤/搜索