我必须尝试使用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}},如何做到这一点?请帮帮我
先谢谢
答案 0 :(得分:0)
在.plist而不是UIInterfaceOrientation
中使用UISupportedInterfaceOrientations
,并将横向定位作为UISupportedInterfaceOrientations列表中的第一个。
答案 1 :(得分:0)
将此行代码放在AppDelegate.m
中- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return UIInterfaceOrientationLandscapeLeft;
}
答案 2 :(得分:0)
可能有所帮助: 用这个方法写
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft];