iphone - shouldAutorotateToInterfaceOrientation 不改变对象位置

标签 iphone ios xcode

- (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/

相关文章:

iphone - UIImageView 第一次显示时出现延迟

ios - Swift SpriteKit 标签没有被删除

ios - 将 paypal 访问与 ios 应用程序集成

ios - 如何用 where 子句重构这个 Swift 协议(protocol)?

ios - XCode 线程中的断点

objective-c - 将 Bison/Flex/Yacc 集成到 XCode 中

ios - 如何在iOS设备上远程安装应用程序

ios - 如何创建具有背景和旋转图像的 iPhone 应用程序?

android - 通过 MouseArea Qt QML 检测向左或向右滑动

swift - MPVolumeView 缩略图未正确水平绘制