根本上每個app都有引導頁,雖然如今這種demo曾經屈指可數,但覺得都不全,所以自己整理了一個,只需求傳入圖片,就可以正常加載出來。由於UIPageControl的小圓點大小和顏色常常與UI設計的不相符,所當前面也會提到重寫類辦法,停止修正。
先看下效果(圖片是在網上隨意找的)

Untitled.gif
把指點頁圖片傳入guideImages中
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSArray* guideImages = @[@"welcomePage_1",@"welcomePage_2",@"welcomePage_3"];
AppInstructionView* guide = [[AppInstructionView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
guide.guideImages = guideImages;
[guide rewritePageControl];
[self.Window.rootViewController.view addSubview:guide];
return YES;
}
假如小圓點不契合需求則在上面修正
currentColor傳入以後圓點的顏色,nextColor傳入其他的顏色,size表示大小
#pragma mark - 重寫pageControl辦法
-(void)rewritePageControl{
_pc = [[CHPageControl alloc]initWithFrame:CGRectMake(_pageSize.width * 0.5, _pageSize.height - 50, 0,0) currentColor:COLOR(72.0, 160.0, 220.0, 1) nextColor:COLOR(99.0, 99.0, 99.0, 1) size:8];
[_pc setBackgroundColor:[UIColor clearColor]];
_pc.userInteractionEnabled=NO;
[_pc setCurrentPage:0];
[_pc setNumberOfPages:_guideImages.count];
[self addSubview:_pc];
}
以上就是本文的全部內容,希望對大家的學習有所協助,也希望大家多多支持本站。
【簡約易用的iOS引導頁制造】的相關資料介紹到這裡,希望對您有所幫助! 提示:不會對讀者因本文所帶來的任何損失負責。如果您支持就請把本站添加至收藏夾哦!