使用方法:
附上庫文件下載地址 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];
}