1

次のようにアプリデリゲートで作成したカスタムナビゲーションバーがあります

- (void) customAppearance
{
    UIImage *customNav = [UIImage imageNamed:@"02_header2.png"];
    [[UINavigationBar appearance] setBackgroundImage:customNav forBarMetrics:UIBarMetricsDefault];
    CGRect frame = CGRectMake(0.0f, 0.0f, 320.0f, 50);
    [[UINavigationBar appearance] setFrame:frame];  
}

それはうまく動作します。ただし、アプリケーションがバックグラウンドに入り、後でフォアグラウンドに入ると、カスタム ナビゲーション バーの読み込みに失敗します。ナビゲーション バーのサイズ (320,44) が表示されます。

ここにappwillenterforeground方法があります

- (void)applicationWillEnterForeground:(UIApplication *)application
{

    UIImage *customNav = [UIImage imageNamed:@"02_header2.png"];
    [[UINavigationBar appearance] setBackgroundImage:customNav forBarMetrics:UIBarMetricsDefault];
    CGRect frame = CGRectMake(0.0f, 0.0f, 320.0f, 50);
    [[UINavigationBar appearance] setFrame:frame];
}

カスタムの nav.bar が読み込まれません。この問題を解決する方法を知っている人はいますか?

4

0 に答える 0