iOS 多图启动页 短视频启动功能实现

[转载]

多张启动页图片、启动添加短视频功能,需要导入助手类文件


使用方法:

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(0012040);

            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:[[NSBundlemainBundle] 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];

}


【亲测可用,可能找不到视频,在copy pods resources中添加一下视频即可】

猜你喜欢

转载自blog.csdn.net/lichuanliangios/article/details/52690235