2012-01-05 3 views
1

IOS5では、UINavigationBarのカスタマイズ方法がまだわかりません。 UINavigationViewControllerがPopoverViewに使用されているIOS5でUINavigationBarをカスタマイズする方法

[[UINavigationBar appearance] setBackgroundColor:[UIColor colorWithWhite:0.5f alpha:1.0]]; 

    [[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIColor blackColor],UITextAttributeTextColor 
,[UIColor blackColor], UITextAttributeTextShadowColor 
,[NSValue valueWithUIOffset:UIOffsetMake(0, 0)], UITextAttributeTextShadowOffset 
,[UIFont fontWithName:@"Arial" size:20.0],UITextAttributeFont 
, nil]]; 


    // Customize UIBarButtonItems 
UIImage *gradientImage44 = [[UIImage imageNamed: @"title__bg.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];  

[[UINavigationBar appearance] setBackgroundImage:gradientImage44 forBarMetrics:UIBarMetricsDefault]; 

    [[UIBarButtonItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],UITextAttributeTextColor 
,[UIColor whiteColor], UITextAttributeTextShadowColor 
,[NSValue valueWithUIOffset:UIOffsetMake(0, 0)], UITextAttributeTextShadowOffset 
,[UIFont fontWithName:@"Arial" size:14.0],UITextAttributeFont 
, nil] forState:UIControlStateNormal]; 

    // Customize back button items differently 
    UIImage *buttonBack30 = [[UIImage imageNamed:@"bn_back"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 13, 0, 5)]; 

    [[UIBarButtonItem appearance] setBackButtonBackgroundImage:buttonBack30 forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; 

このPIC:

私のコードは次のようです。 enter image description here

この写真はModalによって開かれたUINavigationViewControllerです。 enter image description here

ご覧のとおり、私は背景画像を設定しましたが、NavigationBarのボーダーは異なります。

これはPopoverViewの問題ですか?

私には分かりませんでした。

あなたのアドバイスを教えてください。ありがとう!!!ハッピーニューイヤー!!!

+0

http://stackoverflow.com/questions/5575821/custom-nav-bar-styling-ios/6389991#6389991 –

答えて

1

後藤AppDelegate.mを黒色にステータスバーを設定し

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

下のコードを貼り付けます。

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque 
              animated:NO]; 

@「menubar.png」を画像のファイル名に変更します。

UIImage *navBar = [UIImage imageNamed:@"menubar.png"]; 

[[UINavigationBar appearance] setBackgroundImage:navBar 
            forBarMetrics:UIBarMetricsDefault]; 
関連する問題