0

Xcodeに入れようとしたときに、フォトショップでシンプルなデザインを作成しました。NavigationBarで問題が発生しました。

このコードを使用して、UINavigationBarの背景画像(PNG透明画像)を変更しました。

UINavigationBar *navBar = [[self navigationController]navigationBar];
[navBar setBackgroundImage[UIImageimageNamed:@"navBar2.png"]forBarMetrics:UIBarMetricsDefault]

すべて正常に動作しますが、問題は、画像が透明度なしでナビゲーションバーに表示されることです。

誰かが私が満足のいく答えなしでどこでも検索する透明性の問題を修正するのを手伝ってください
NB!IOS5を使用しています

4

4 に答える 4

3

ナビゲーション バーを半透明に設定してみてください。

[navBar setTranslucent: YES];
于 2012-07-31T18:58:30.417 に答える
0

あなたができることは、navigationControllerのビューの背景色をメインビューの背景色と同じに設定することです。

//Set your view's background color    
[self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"view_background"]]];

//Set your custom image for the navigationController
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed: @"navigation_bar_image"] forBarMetrics:UIBarMetricsDefault];

//And then set the background color of the navigationController the same as the one of the view
[self.navigationController.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"view_background"]]];
于 2013-02-22T13:41:48.627 に答える
0

ストーリーボードにそれがありますか?ナビゲーション バーのスタイルを黒の半透明に変更してみてください。

于 2012-07-31T18:54:02.787 に答える