-1

我用按钮和图像在横向模式下设计了我的笔尖,但在模拟器中它以横向模式显示,但按钮和图像不像笔尖上的那样,它们似乎在右侧而不是在顶部?请有任何指示。笔尖图片模拟器

4

3 回答 3

0

使用此代码

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;
}

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
     if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
            toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
    {
          NSLog(@"Landscape Mode");
          // your code when your sdk is in landscape mode
    }
    else
    {
          NSLog(@"Portrait Mode");
          // your code here
    }
}
于 2012-06-15T13:24:43.867 回答
0

如果您希望此视图控制器仅限于某个方向,请在您的视图控制器类中使用

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

请在此处阅读我的答案保持 iPhone 横向旋转?

于 2012-06-15T13:21:16.530 回答
0

您如何在界面构建器中设计视图(纵向/横向)不会影响它的实际显示方式。您需要在代码中(或可能在 p 列表中)进行设置。

于 2012-06-15T14:00:39.080 回答