基本上每個(gè)app都有引導(dǎo)頁,雖然現(xiàn)在這種demo已經(jīng)比比皆是,但感覺都不全,所以自己整理了一個(gè),只需要傳入圖片,就可以正常加載出來。由于UIPageControl的小圓點(diǎn)大小和顏色經(jīng)常與UI設(shè)計(jì)的不相符,所以后面也會(huì)提到重寫類方法,進(jìn)行修改。
先看下效果(圖片是在網(wǎng)上隨便找的)

Untitled.gif
把指導(dǎo)頁圖片傳入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;}如果小圓點(diǎn)不符合需求則在下面修改
currentColor傳入當(dāng)前圓點(diǎn)的顏色,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];}以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持VEVB武林網(wǎng)。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注