1

我必须尝试横向的 iPad 应用程序,所以 info.plist 中的一些更改是

在此处输入图像描述 AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];

    CGRect screenBound = [[UIScreen mainScreen] bounds];
    NSLog(@"screenBound:%@",NSStringFromCGRect(screenBound));

    return YES;
}

然后我从 CGRect 得到屏幕分辨率是 screenBound:{{0, 0}, {768, 1024}} 但我想要 {{0, 0}, {1024, 768}},怎么做?请帮我

提前致谢

4

3 回答 3

0

将此行代码放在 AppDelegate.m

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
    return UIInterfaceOrientationLandscapeLeft;
}
于 2013-02-08T10:19:40.603 回答
0

在您的 .plist中UIInterfaceOrientation使用UISupportedInterfaceOrientations, 并使横向方向成为 UISupportedInterfaceOrientations 列表中的第一个。

于 2013-02-08T10:18:29.813 回答
0

可能有帮助:用这个方法写

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions


[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft];
于 2013-02-08T11:11:52.657 回答