• 用视频做启动页


    - (void) showStartMedia{
    
        NSString *path = [[NSBundle mainBundle] pathForResource:@"loadingVedio3" ofType:@"m4v"];
        NSURL *url = [NSURL fileURLWithPath:path];
        _mediaVC = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
        
        CGRect rect = [[UIScreen mainScreen] bounds];
        _mediaVC.view.frame = rect;
        _mediaVC.moviePlayer.controlStyle = MPMovieControlStyleNone;
        _mediaVC.moviePlayer.scalingMode = MPMovieScalingModeAspectFill;
        [self.view addSubview:_mediaVC.view];
        
        if ([_mediaVC.moviePlayer respondsToSelector:@selector(prepareToPlay)])
        {
            [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(stopPlayerCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:_mediaVC.moviePlayer];
        }
    }
    
    - (void) stopPlayerCallback:(id)sender
    {
        _mediaVC.view.alpha = 1.;
        [UIView beginAnimations:@"MEDIA" context:nil];
        [UIView setAnimationDuration:0.85];
        [UIView setAnimationDelegate:self];
        [UIView setAnimationDidStopSelector:@selector(OnStoped)];
        _mediaVC.view.alpha = 0.;
        [UIView commitAnimations];
        
        //
        [self loadingViewDidDone];
    }
    
    - (void)OnStoped
    {
        [_mediaVC.view removeFromSuperview];
        _mediaVC = nil;
    }
    
    - (void) loadingViewDidDone{
        
        if (self.loadingVCBlock !=nil) {
            
            [self loadingVCBlock]();
        }
    }
    
    - (void)didReceiveMemoryWarning {
        [super didReceiveMemoryWarning];
        // Dispose of any resources that can be recreated.
    }
  • 相关阅读:
    版本控制之GitHub亲手实验总结
    Java的HashMap是如何实现的?
    Junit
    由swap引发的关于按值传递和引用传递的思考与总结
    C++了解free和delete
    GitHub使用教程
    Oracle下SQL学习笔记
    Flappy Bird
    尾递归与Continuation(转载)
    十步完全理解SQL(转载)
  • 原文地址:https://www.cnblogs.com/fs-ios/p/5148872.html
Copyright © 2020-2023  润新知