2011-08-09 5 views
0

私はnavigationControllerのnavigationBarが隠さ作る方法を知っている:一部のUINavigationControllerのNavigationBarのみを非表示にしますか?

@implementation UINavigationBar (custom) 
    - (void)drawRect:(CGRect)rect {} 
@end 

UIImagePickerControllerを表示する場合しかし、それはまた、それに適用されます。

UIImagePickerController *picker = [[UIImagePickerController alloc] init]; 
picker.delegate = self; 
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
picker.navigationBar.tintColor = [UIColor blackColor]; 
picker.navigationBar.barStyle = UIBarStyleBlackOpaque; // Or whatever style. 
[self presentModalViewController:picker animated:NO]; 

navigationControllerのnavigationBarを透明にする方法はありますか?

ありがとうございました。

答えて

0

012BがUINavigationBarの異なるインスタンスに対して異なる動作をする必要がある場合は、objc_setAssociatedObjectのようなものを使用して、透過する必要があるかどうかの指標を記録できます。次に-drawRect:objc_getAssociatedObjectselfに設定すると、何をすべきかを知ることができます。

+0

これはバー全体を隠すことになります。私はちょうどその背景を透明にしたいです(そのコードは何ですか?) – iosfreak

+0

このプロパティは、View Controllerの '-viewDidAppear'または' -viewDidDisAppear'メソッドで設定または解除できます。 –

+0

@ phpnerd211:OK、私は自分の答えを更新しました。 – jtbandes

関連する問題