2013-02-08 76 views
1

我有試過的iPad應用橫向如此做的info.plist一些變化在iPad中開始橫向導航?

enter image description here 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

感謝在你的.plist代替UIInterfaceOrientation使用UISupportedInterfaceOrientations,使景觀orientaation在UISupportedInterfaceOrientations列表中的第一個。

0

放置在AppDelegate.m

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window 
{ 
    return UIInterfaceOrientationLandscapeLeft; 
} 
0

這行代碼可以幫助: 寫在這個方法中

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


[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft];