KEEP引導(dǎo)頁

KEEP引導(dǎo)頁


簡介:
一個(gè)好的引導(dǎo)頁會使得用戶體驗(yàn)大大提升,那么視頻引導(dǎo)頁是一個(gè)不錯的創(chuàng)新,頁面分為視頻,logo 輪播字, 以及注冊登錄兩個(gè)按鈕。


界面預(yù)覽:

Keep.gif

代碼簡單介紹:
1.導(dǎo)入框架
MediaPlayer.framework
2.在Main.storyboard中進(jìn)行視圖的創(chuàng)建
3.主要方法實(shí)現(xiàn)如下:

    -(void)playbackStateChanged{


//取得目前狀態(tài)
MPMoviePlaybackState playbackState = [_moviePlayer playbackState];

//狀態(tài)類型
switch (playbackState) {
    case MPMoviePlaybackStateStopped:
        [_moviePlayer play];
        break;
        
    case MPMoviePlaybackStatePlaying:
        NSLog(@"播放中");
        break;
        
    case MPMoviePlaybackStatePaused:
        [_moviePlayer play];
        break;
        
    case MPMoviePlaybackStateInterrupted:
        NSLog(@"播放被中斷");
        break;
        
    case MPMoviePlaybackStateSeekingForward:
        NSLog(@"往前快轉(zhuǎn)");
        break;
        
    case MPMoviePlaybackStateSeekingBackward:
        NSLog(@"往后快轉(zhuǎn)");
        break;
        
    default:
        NSLog(@"無法辨識的狀態(tài)");
        break;
}
    }




    -(void)updateViewConstraints{

[super updateViewConstraints];

self.viewWidth.constant = CGRectGetWidth([UIScreen mainScreen].bounds) *4 ;
self.secondViewLeading.constant = CGRectGetWidth([UIScreen mainScreen].bounds);

self.thirdViewLeading.constant = CGRectGetWidth([UIScreen mainScreen].bounds) *2;
self.fourViewLeading.constant =CGRectGetWidth([UIScreen mainScreen].bounds) *3;
self.firstLabelWidth.constant = CGRectGetWidth([UIScreen mainScreen].bounds);

self.secondLabelWidth.constant =CGRectGetWidth([UIScreen mainScreen].bounds);
self.thridLabelWidth.constant = CGRectGetWidth([UIScreen mainScreen].bounds);
    }



    //ios以后隱藏狀態(tài)欄
    -(BOOL)prefersStatusBarHidden{

return YES;
    }- (UIStatusBarStyle)preferredStatusBarStyle
    {
return UIStatusBarStyleLightContent;
    }

    -(void)setupTimer{

self.timer = [NSTimer timerWithTimeInterval:3.0f target:self selector:@selector(timerChanged) userInfo:nil repeats:YES];

[[NSRunLoop currentRunLoop]addTimer:self.timer forMode:NSRunLoopCommonModes];

    }

    -(void)pageChanged:(UIPageControl *)pageControl{

CGFloat x = (pageControl.currentPage) * [UIScreen mainScreen].bounds.size.width;

[self.scrollView setContentOffset:CGPointMake(x, 0) animated:YES];


    }

    -(void)timerChanged{
int page  = (self.pageControl.currentPage +1) %4;

self.pageControl.currentPage = page;

[self pageChanged:self.pageControl];


    }- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
double page = self.scrollView.contentOffset.x / self.scrollView.bounds.size.width;
self.pageControl.currentPage = page;

if (page== - 1)
{
    self.pageControl.currentPage = 3;// 序號0 最后1頁
}
else if (page == 4)
{
    self.pageControl.currentPage = 0; // 最后+1,循環(huán)第1頁
    [self.scrollView setContentOffset:CGPointMake(0, 0) animated:YES];
}
    }- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
[self.timer invalidate];
    }- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{

[self setupTimer];

    }

下載地址:
http://pan.baidu.com/s/1c2fTe9q

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容