【问题标题】:How can I stop Full screen video after I resize it?调整大小后如何停止全屏视频?
【发布时间】:2012-03-21 06:33:40
【问题描述】:

我尝试使用捏合手势调整视频大小。但是在我捏和动画调整大小之后,视频会变成我不想要的全屏。 如何停止全屏??

看看我的代码,请帮助我

{
    NSString *moviePath = [[NSBundle mainBundle] pathForResource:@"video1" ofType:@"MOV"];
        movie = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:moviePath]];
        movie.view.backgroundColor = [UIColor blackColor];
        movie.controlStyle = MPMovieControlStyleDefault;
        movie.shouldAutoplay = YES;


    movie.view.frame = CGRectMake(0, 50, 720, 1280);
    [self.view addSubview:movie.view];
    [movie play];

    // -----------------------------------
    // Add BlockView for block user touch
    // -----------------------------------
    blockView.frame = CGRectMake(0, 50, 760, 1280);
    blockView.alpha = 0.2;
    [self.view addSubview:blockView];

    // -----------------------------
    // Add Pinch Gesture
        // -----------------------------
        UIPinchGestureRecognizer *pinchIt = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchIn:)];
        [self.blockView addGestureRecognizer:pinchIt];
 }  




-(void)pinchIn:(UIPinchGestureRecognizer *)recognize
{
    [movie pause];

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDuration:2];

    movie.view.transform = CGAffineTransformMakeScale(0.5, 0.5);
    [UIView commitAnimations];
    [movie setFullscreen:NO animated:NO];
    //movie.view.frame = CGRectMake(100, 150, 360, 640);  << Have try this but didnt work
    [movie play];
}

【问题讨论】:

    标签: objective-c xcode ipad xcode4 uipinchgesturerecognizer


    【解决方案1】:

    您的代码似乎运行良好。尝试先设置中心。 movie.view.center = CGPointMake(self.view.frame.size.width/2,self.view.frame.size.height/2);

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-07-09
      • 1970-01-01
      • 1970-01-01
      • 2016-04-09
      • 1970-01-01
      • 2014-09-01
      • 1970-01-01
      相关资源
      最近更新 更多