Realization of short video startup function on iOS multi-picture startup page

[Reprinted]

Multiple startup page pictures, start adding short video function, need to import assistant class files


Instructions:

1. Import the header file

#import "XZMCoreNewFeatureVC.h"

#import "CALayer+Transition.h"



2. Multiple startup pages

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

    

    self.window = window;

    

    // Judge whether it needs to be displayed: (internal version and local version cache have been considered)

    BOOL canShow = [XZMCoreNewFeatureVC canShowNewFeature];

    

    // Test code, the official version should be deleted

    canShow = YES;

    

    if (canShow){  //  Initialize the new feature interface

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

            

            NSLog( @" Enter the main page " );

            [self enter];

            

        } configuration:^(UIButton *enterButton) {  //  Configure the enter button

            [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. Start the small video

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

    

    self.window = window;

    

    // Judge whether it needs to be displayed: (internal version and local version cache have been considered)

    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];

}


[Personal testing is available, you may not be able to find the video, just add the video to copy pods resources]

Guess you like

Origin blog.csdn.net/lichuanliangios/article/details/52690235
Recommended