zoukankan      html  css  js  c++  java
  • 用视频做启动页

    - (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.
    }
  • 相关阅读:
    Cocos2d-js 开发记录:图片数据资源等的异步加载
    Cocos2d-js 开发记录:声音播放
    Cocos2d-js 开发记录-初始
    PAT 1064 Complete Binary Search Tree
    python 对象属性与 getattr & setattr
    LeetCode Text Justification
    LeetCode Valid Number
    LeetCode String to Integer (atoi)
    struts2--标签取值
    java--Hibernate实现分页查询
  • 原文地址:https://www.cnblogs.com/fs-ios/p/5148872.html
Copyright © 2011-2022 走看看