- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (interfaceOrientation == (UIInterfaceOrientationPortrait))
[self embedYouTube:yout frame:CGRectMake(30, 155, 260, 200)];
if (interfaceOrientation == (UIInterfaceOrientationLandscapeRight))
[self embedYouTube:yout frame:CGRectMake(30, 155, 400, 200)];
if (interfaceOrientation == (UIInterfaceOrientationLandscapeLeft))
[self embedYouTube:yout frame:CGRectMake(30, 155, 400, 200)];
if (interfaceOrientation == (UIInterfaceOrientationPortraitUpsideDown))
[self embedYouTube:yout frame:CGRectMake(30, 155, 260, 200)];
return YES;
}
旋转时,我尝试更改embedYouTube的大小和位置,但不起作用。
它可能正在旋转,但不会更改位置和大小。
最佳答案
尝试将您的代码移动到willAnimateRotationToInterfaceOrientation:方法
关于iphone - shouldAutorotateToInterfaceOrientation不更改对象位置,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11523153/