1

我只是想写一个基于视图的应用程序,它只使用横向方向。

使用此代码:

application.statusBarOrientation = UIInterfaceOrientationLandscapeRight;

applicationDidFinishedLaunching应用程序以横向启动的方法中。

问题是,如果我在 InterfaceBuilder 中创建一个横向视图,该视图不会以我创建它的方式显示出来......我需要在纵向模式下创建视图并想象它在纵向模式下的外观(希望你明白我的意思?) - 我插入已经旋转的图像。所以,我现在一切正常,但 InfoButton 没有旋转(与其他按钮一样,但其他按钮已经旋转了图像)......

我的错是什么?如何告诉应用程序使用我在横向设计的视图?

非常感谢。

问候

4

2 回答 2

0

您无需在纵向模式下创建视图并想象它在纵向模式下的外观。只需要以所需的模式创建视图,然后将项目设置设置为所需的模式。在Xcode左侧视图中,您可以看到Project Navigator单击项目名称的蓝色图标。现在在中间视图(编辑器视图)上,您可以看到summary选项卡,在此选项卡上将您需要的模式设置为iPhone Development Orientations.

于 2011-11-05T19:33:37.573 回答
0

您可能需要根据方向旋转视图(按钮):

UIInterfaceOrientation orientation = [UIDevice currentDevice].orientation;
CGAffineTransform transform;
switch (orientation) {
    case UIDeviceOrientationPortrait:
        transform = CGAffineTransformIdentity;
        break;
    case UIDeviceOrientationPortraitUpsideDown:
        transform = CGAffineTransformMakeRotation(180*M_PI/180);
        break;
    case UIDeviceOrientationLandscapeLeft:
        transform = CGAffineTransformMakeRotation(90*M_PI/180);
        break;
    case UIDeviceOrientationLandscapeRight:
        transform = CGAffineTransformMakeRotation(-90.0*M_PI/180);
        break;
    default:
        transform = CGAffineTransformIdentity;
        break;
}
[[myView layer] setAffineTransform:transform];
于 2010-02-02T14:26:21.033 回答