iPhoneとiPadの別々のプロジェクトを組み合わせることで、私のアプリを普遍的にしました。すべてが機能しているようですが、大きなバグが1つあります。ViewControllerは、アプリケーションを終了して再起動するまで表示されません。
iPadアプリが起動すると、黒い画面(おそらくウィンドウ)とステータスバーが表示されます。私はホームボタンを押すと、SplitViewControllerが消えるのを突然見ています。私が再びアプリケーションを開くと、SplitViewControllerが表示されます。
私は、なぜコントローラが表示されているのかわかりません。何か案は?
(特定の場所のコードサンプルが必要な場合は、この原因が何であるかわかりません)
ありがとうございました。
編集:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[Appirater appLaunched:YES];
// Registers this class as the delegate of the audio session.
[[AVAudioSession sharedInstance] setDelegate: self];
// Allow the app sound to continue to play when the screen is locked.
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
justOpened = YES;
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
{deleted}
} else {
[self.window addSubview:self.splitViewController.view];
[self.window makeKeyAndVisible];
CGRect rect = CGRectMake(-2, self.window.frame.size.height-29, self.window.frame.size.width+2, 29);
imgBar = [[UIImageView alloc] initWithFrame:rect];
imgBar.contentMode = UIViewContentModeScaleToFill;
imgBar.image = [UIImage imageNamed:@"wood_btm.png"];
imgBar.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleTopMargin;
self.splitViewController.showsMasterInPortrait = YES;
self.splitViewController.title = @"Exams";
self.splitViewController.splitPosition=280;
}
return YES;
}
アップデート:私はいくつかの理由でビュー階層の最上位にあることを発見した
ウィンドウの背景色をいじりことで。私はウィンドウの背景色をクリアにして、SplitViewControllerを見ることができました。不思議なことに私はそれとやりとりすることもできます。だから本質的に私は窓をはっきりさせることで問題を解決しました。これは明らかに理想的な解決策ではありませんが、だれかが原因を考えることができれば私に教えてください。
ストーリーボードを使用していますか? – ryudice
@ryudiceいいえ標準xibです。 –
-applicationDidFinishLaunching:WithOptions:メソッドをポストします。 – CodaFi