开发者

Make only some UINavigationController's NavigationBar hidden?

I know how to make a navigationController's navigationBar hidden:

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

However, when displaying a UIImagePickerController it also applied to it.

UIImagePickerController *p开发者_高级运维icker = [[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];

Is there a way to only make some of the navigationController's navigationBar transparent?

Thanks.


If you need -drawRect: to behave differently for different instances of UINavigationBar, you could use something like objc_setAssociatedObject to record some indicator of whether it should be transparent. Then in -drawRect: you can use objc_getAssociatedObject on self to find out what to do.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜