I have application which plays video. It was great and good working in ios7 but now in iOs8 it is broken
我有播放视频的应用程序。在ios7中工作非常棒,但是现在在iOs8中它已经坏了
self.player = [[MPMoviePlayerController alloc] initWithContentURL:self.videoFileToDisplay];
[self.player play];
[self.view setBackgroundColor:[UIColor redColor]];
[self.player.view setBackgroundColor:[UIColor greenColor]];
UIView *playerView = self.player.view;
[self.view addSubview:playerView];
playerView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[playerView]|"
options:0
metrics:nil
views:NSDictionaryOfVariableBindings(playerView)]];
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[playerView]|"
options:0
metrics:nil
Also depending on horizontal or vertical video it is i need to rotate it
同样取决于水平或垂直视频,我需要旋转它
- (void)adoptVideoToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation withDuration:(NSTimeInterval)duration
{
CGFloat horizontalVideoAngle = 0;
CGFloat verticalVideoAngle = 0;
switch (toInterfaceOrientation) {
case UIDeviceOrientationLandscapeLeft:
horizontalVideoAngle = 0;
verticalVideoAngle = M_PI_2;
break;
case UIDeviceOrientationLandscapeRight:
horizontalVideoAngle = 0;
verticalVideoAngle = -M_PI_2;
break;
case UIDeviceOrientationPortraitUpsideDown:
verticalVideoAngle = 0;
horizontalVideoAngle = M_PI_2;
break;
case UIDeviceOrientationPortrait:
verticalVideoAngle = 0;
horizontalVideoAngle = -M_PI_2;
break;
default:
return;
}
CGFloat angle = [self isHorizontalVideo] ? horizontalVideoAngle : verticalVideoAngle;
self.player.view.transform = CGAffineTransformMakeRotation( angle );
}
It is good at all orientations except portrait. Even UpsideDown is good Here are screenshots
除肖像外,它在所有方向都很好。甚至UpsideDown也不错以下是截图
What is wrong with portrait orientation in ios8 ?
ios8中的纵向方向有什么问题?
PS red view is background of mediaPlayer superview
PS红色视图是mediaPlayer superview的背景
1 个解决方案
#1
0
Looks like Apple changed rotation in ios8 now it rotates content only and doesn't affect view frame. So i ended up adding additional scale transform
看起来Apple改变了ios8中的旋转现在它只旋转内容而不影响视图框架。所以我最终添加了额外的比例变换
#1
0
Looks like Apple changed rotation in ios8 now it rotates content only and doesn't affect view frame. So i ended up adding additional scale transform
看起来Apple改变了ios8中的旋转现在它只旋转内容而不影响视图框架。所以我最终添加了额外的比例变换