Ios 在iPad中开始横向定位?
我已经尝试了iPad应用程序的横向定位,所以在info.plist中做了一些更改 AppDelegate.mIos 在iPad中开始横向定位?,ios,xcode,ipad,orientation,landscape,Ios,Xcode,Ipad,Orientation,Landscape,我已经尝试了iPad应用程序的横向定位,所以在info.plist中做了一些更改 AppDelegate.m - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
- (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;
}
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return UIInterfaceOrientationLandscapeLeft;
}
然后我从CGRect得到屏幕分辨率是屏幕绑定的:{{0,0},{768,1024}
但是我想要{0,0},{1024768},怎么做?请帮帮我
在.plist中提前感谢而不是
UIInterfaceOrientation
使用UISupportedInterfaceOrientations
,并将横向方向设置为UISupportedInterfaceOrientations列表中的第一个方向。将此行代码放在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;
}
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return UIInterfaceOrientationLandscapeLeft;
}
可能会有帮助:
用这个方法写
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft];