Как я могу остановить полноэкранное видео после изменения его размера? - PullRequest
0 голосов
/ 21 марта 2012

Я пытаюсь изменить размер видео с помощью Pinch Gesture. Но после того, как я ущипнул и анимировал изменение размера, видео стало полноэкранным, что мне не нужно. Как я могу остановить полный экран ??

взгляните на мой код и, пожалуйста, помогите мне

{
    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];
}

1 Ответ

0 голосов
/ 21 марта 2012

Ваш код работает нормально.Попробуйте сначала установить центр.movie.view.center = CGPointMake (self.view.frame.size.width / 2, self.view.frame.size. height / 2);

...