带小视频的引导图

2016-11-03  本文已影响43人  亦晴工作室

使用方法:

附上库文件下载地址 https://git.oschina.net/19941225/VideoGuide.git

1、导入头文件

#import "XZMCoreNewFeatureVC.h"
#import "CALayer+Transition.h"

2、多张启动页

    UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];

    

    self.window = window;

    

    //判断是否需要显示:(内部已经考虑版本及本地版本缓存)

    BOOL canShow = [XZMCoreNewFeatureVC canShowNewFeature];

    

    //测试代码,正式版本应该删除

    canShow = YES;

    

    if(canShow){ // 初始化新特性界面

        window.rootViewController = [XZMCoreNewFeatureVC newFeatureVCWithImageNames:@[@"new1",@"new2",@"new3",@"new4"] enterBlock:^{

            

            NSLog(@"进入主页面");

            [self enter];

            

        } configuration:^(UIButton *enterButton) { // 配置进入按钮

            [enterButton setBackgroundImage:[UIImage imageNamed:@"btn_nor"] forState:UIControlStateNormal];

            [enterButton setBackgroundImage:[UIImage imageNamed:@"btn_pressed"] forState:UIControlStateHighlighted];

            enterButton.bounds = CGRectMake(0, 0, 120, 40);

            enterButton.center = CGPointMake(KScreenW * 0.5, KScreenH* 0.85);

        }];

        

    }else{

        

        [self enter];

    }

    

    [window makeKeyAndVisible];

    

    return YES;

3、启动小视频

    UIWindow *window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];

    

    self.window = window;

    

    //判断是否需要显示:(内部已经考虑版本及本地版本缓存)

    BOOL canShow = [XZMCoreNewFeatureVC canShowNewFeature];

    

    //测试代码,正式版本应该删除

    canShow = YES;

    

    if(canShow){ // 初始化新特性界面

        window.rootViewController = [XZMCoreNewFeatureVC newFeatureVCWithPlayerURL:[[NSBundle mainBundle] URLForResource:@"启动视频.mp4" withExtension:nil] enterBlock:^{

            

            NSLog(@"进入主页面");

            [self enter];

        } configuration:^(AVPlayerLayer *playerLayer) {

            

        }];

        

    }else{

        

        [self enter];

    }

    

    [window makeKeyAndVisible];

    

    return YES;

4、进入主页面

// 进入主页面

-(void)enter{

    

    UIViewController *vc = [[UIViewController alloc] init];

    vc.view.backgroundColor = [UIColor brownColor];

    self.window.rootViewController = vc;

    [self.window.layer transitionWithAnimType:TransitionAnimTypeRamdomsubType:TransitionSubtypesFromRamdom curve:TransitionCurveRamdom duration:2.0f];

}
上一篇下一篇

猜你喜欢

热点阅读