IOS_NavigationBar full transparency, ios_navigationbar
First:
1. First, set a pure transparent png image as the background of navigationBar.
[Self. navigationController. navigationBarsetBackgroundImage: [UIImageimageNamed: @ "-1.png"] forBarMetrics: UIBarMetricsDefault];
2. After executing the above line of code, it is found that the navigationBar is set to transparent, but there is a line below the Bar ". That is.
To achieve thorough transparency, you need to add a few lines of code:
If ([self. navigationController. navigationBarrespondsToSelector: @ selector (setBackgroundImage: forBarMetrics :)]) {
NSArray * list = self. navigationController. navigationBar. subviews;
For (id objin list ){
If ([obj isKindOfClass: [UIImageViewclass]) {
UIImageView * imageView = (UIImageView *) obj;
ImageView. hidden = YES;
}
}
}
If you have any questions, please leave a message ~