したがって、AppDelegate.m に次の関数があります。
- (BOOL) application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
[CDVLocalStorage __verifyAndFixDatabaseLocations];
NSURL* url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];
if (url && [url isKindOfClass:[NSURL class]]) {
invokeString = [url absoluteString];
NSLog(@"PHR launchOptions = %@", url);
}
CGRect screenBounds = [[UIScreen mainScreen] bounds];
self.window = [[UIWindow alloc] initWithFrame:screenBounds];
self.window.autoresizesSubviews = YES;
self.detailViewController
self.detailViewController = [[MainViewController alloc] init];
self.detailViewController.useSplashScreen = YES;
self.detailViewController.wwwFolderName = @"www";
self.detailViewController.startPage = @"index.html";
self.detailViewController.invokeString = invokeString;
NSString *deviceType = [UIDevice currentDevice].model;
if (![deviceType hasPrefix:@"iPad"] && ![deviceType hasPrefix:@"iPad Simulator"])
{
CGRect viewBounds = [[UIScreen mainScreen] applicationFrame];
detailViewController.view.frame = viewBounds;
BOOL forceStartupRotation = YES;
UIDeviceOrientation curDevOrientation = [[UIDevice currentDevice] orientation];
if (UIDeviceOrientationUnknown == curDevOrientation) {
curDevOrientation = (UIDeviceOrientation)[[UIApplication sharedApplication] statusBarOrientation];
}
if (UIDeviceOrientationIsValidInterfaceOrientation(curDevOrientation)) {
if ([self.detailViewController supportsOrientation:curDevOrientation]) {
forceStartupRotation = NO;
}
}
if (forceStartupRotation) {
UIInterfaceOrientation newOrient;
if ([self.detailViewController supportsOrientation:UIInterfaceOrientationPortrait])
newOrient = UIInterfaceOrientationPortrait;
else if ([self.detailViewController supportsOrientation:UIInterfaceOrientationLandscapeLeft])
newOrient = UIInterfaceOrientationLandscapeLeft;
else if ([self.detailViewController supportsOrientation:UIInterfaceOrientationLandscapeRight])
newOrient = UIInterfaceOrientationLandscapeRight;
else
newOrient = UIInterfaceOrientationPortraitUpsideDown;
NSLog(@"AppDelegate forcing status bar to: %d from: %d", newOrient, curDevOrientation);
[[UIApplication sharedApplication] setStatusBarOrientation:newOrient];
}
self.window.rootViewController = self.detailViewController;
} else {
NavViewController *leftViewController = [[NavViewController alloc] initWithNibName:@"NavViewController" bundle:nil];
UINavigationController *leftNavViewController = [[UINavigationController alloc] initWithRootViewController:leftViewController];
leftNavViewController.navigationBarHidden = YES;
UINavigationController *detailNavigationController = [[UINavigationController alloc] initWithRootViewController:detailViewController];
detailNavigationController.navigationBarHidden = YES;
leftViewController.detailViewController = detailViewController;
self.splitViewController = [[UISplitViewController alloc] init];
self.splitViewController.viewControllers = [NSArray arrayWithObjects:leftNavViewController, detailNavigationController, nil];
self.window.rootViewController = self.splitViewController;
self.splitViewController.delegate = detailViewController;
detailViewController.svc = self.splitViewController;
}
[self.window makeKeyAndVisible];
return YES;
}
はい、私はそれがたくさんのコードであることを知っていますが、この関数の内部では正確に何が間違っているのかわからないため、何を切り取ればよいか完全にわかりません。
基本的に、私のアプリは横向きモードで iPad に読み込まれますが、スプラッシュ スクリーンは 90 度回転し、横向きではなく縦向きに表示され、実際のスプラッシュ スクリーンに戻ります。コードを見ると、デバイス チェックの else ステートメントで実行されていることがわかります。それ以外は、どのような変更を加える必要があるかを理解するために皆さんの助けを借りることができます。