在寫的時(shí)候,把問題想復(fù)雜化了。后來(lái)發(fā)現(xiàn)系統(tǒng)自帶的
MediaPlayer/MediaPlayer.h
配合簡(jiǎn)單的動(dòng)畫就可以完成這個(gè)登錄界面贴谎。并沒有什么難度。
需要注意的是 視頻控制器的幾個(gè)屬性季稳。
_moviePlayer.repeatMode=MPMovieRepeatModeOne;
_moviePlayer.shouldAutoplay=YES;
[_moviePlayersetFullscreen:YES];
[_moviePlayersetScalingMode:MPMovieScalingModeAspectFill];
[_moviePlayersetControlStyle:MPMovieControlStyleNone];
- (void)viewDidLoad {
[superviewDidLoad];
NSString* path = [[NSBundlemainBundle]pathForResource:@"mp4"ofType:@"mp4"];
_movieURL= [NSURLfileURLWithPath:path];
[selfreadyPlayer];
//創(chuàng)建view
UIView*newView=[[UIViewalloc]initWithFrame:CGRectMake(0,HEIGHT-84,WIDTH,64)];
newView.backgroundColor=[UIColorclearColor];
UIButton*loginBtn=[[UIButtonalloc]initWithFrame:CGRectMake(10,10, (WIDTH-20-30)/2,40)];
UIButton*regBtn=[[UIButtonalloc]initWithFrame:CGRectMake(10+30+(WIDTH-20-30)/2,10, (WIDTH-20-30)/2,40)];
loginBtn.backgroundColor=[UIColorwhiteColor];
[loginBtnsetTitleColor:[UIColorcolorWithRed:0.627green:0.631blue:0.651alpha:1.000]forState:UIControlStateNormal];
[loginBtnsetTitle:@"登錄"forState:UIControlStateNormal];
[loginBtn.layersetMasksToBounds:YES];
[loginBtn.layersetCornerRadius:5];//設(shè)置矩形四個(gè)圓角半徑
loginBtn.titleLabel.font= [UIFontsystemFontOfSize:15];
regBtn.backgroundColor=[UIColorcolorWithRed:0.247green:0.671blue:0.788alpha:1.000];
[regBtnsetTitleColor:[UIColorcolorWithRed:0.963green:0.972blue:1.000alpha:1.000]forState:UIControlStateNormal];
[regBtnsetTitle:@"注冊(cè)"forState:UIControlStateNormal];
regBtn.titleLabel.font= [UIFontsystemFontOfSize:15];
[regBtn.layersetMasksToBounds:YES];
[regBtn.layersetCornerRadius:5];//設(shè)置矩形四個(gè)圓角半徑
[newViewaddSubview:regBtn];
[newViewaddSubview:loginBtn];
[self.viewaddSubview:newView];
regBtn.alpha=0;
loginBtn.alpha=0;
[loginBtnaddTarget:selfaction:@selector(btnClick)forControlEvents:UIControlEventTouchDown];
[regBtnaddTarget:selfaction:@selector(btnClick)forControlEvents:UIControlEventTouchDown];
[UIViewanimateWithDuration:3animations:^{
regBtn.alpha=1;
loginBtn.alpha=1;
}completion:^(BOOLfinished) {
}];
}
-(void)btnClick
{
NSLog(@"登錄or注冊(cè)");
}
- (void) readyPlayer
{
[selfsetNeedsStatusBarAppearanceUpdate];
_moviePlayer= [[UBerBackgroundMoviealloc]initWithContentURL:_movieURL];
_moviePlayer.repeatMode=MPMovieRepeatModeOne;
_moviePlayer.shouldAutoplay=YES;
[_moviePlayersetFullscreen:YES];
[_moviePlayersetScalingMode:MPMovieScalingModeAspectFill];
[_moviePlayersetControlStyle:MPMovieControlStyleNone];
[[_moviePlayerview]setFrame:self.view.frame];
[[selfview]addSubview:[_moviePlayerview]];
[_moviePlayerplay];
}