0

The New iPad を含む他のシミュレーターでうまく機能するプロジェクトがあります。ただし、iPhone5 では、デリゲートで Viewcontroller を呼び出すとクラッシュします。なぜこのエラーが発生するのかわかりません。以下のコードで考えられる原因を発見した場合はお知らせください。

self.rootviewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil]; 
self.rootNavController = [[UINavigationController alloc]
self.rootNavController.navigationBar.hidden=YES;
[window addSubview:rootNavController.view];'

以下の画像を参照してください。 エラー

どうもありがとうございました

4

1 に答える 1

1

の作成に何か問題があると思います。UINavigationController次のコードを試して、あなたのものを置き換えてくださいAppDelegate.m

編集でスプラッシュスクリーンを表示および削除するコードを追加UIViewController

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    // Create View Controller
    RootViewController *rootViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];

    // Create Navigation Controller
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];

    // Create Navigation Controller
    self.window.rootViewController = navigationController;
    [self.window makeKeyAndVisible];

    // SplashScreen
    [self displaySplashscreen];

    return YES;
}

#pragma mark - SplashScreen Methods
- (void)displaySplashscreen
{
    // Create View
    self.splashscreenViewController = [[SplashscreenViewController alloc] init];

    // Display Splashscreen
    [_window addSubview:_splashscreenViewController.view];

    // Dismiss Splashscreen
    [self performSelector:@selector(dismissSplashscreen) withObject:nil afterDelay:3.0f]; // Modify the time
}

- (void)dismissSplashscreen
{
    // Splashscreen Animation
    [UIView animateWithDuration:0.5f
                     animations:^{
                         _splashscreenViewController.view.alpha = 0.0f;
                     } completion:^(BOOL finished) {
                         [_splashscreenViewController.view removeFromSuperview];
                     }];
}
于 2013-11-05T16:37:32.023 に答える