//去掉导航栏分割线
UIImage*img = [UIImagenew];
[self.navigationController.navigationBar setBackgroundImage:img forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.shadowImage = [[UIImage alloc] init];
或
- (void)setNavLineHidden:(BOOL)hidden{
if([self.navigationController.navigationBarrespondsToSelector:@selector(setBackgroundImage:forBarMetrics:)]){
NSArray *list=self.navigationController.navigationBar.subviews;
UIImageView*_navLine = [UIImageViewnew];
for(idobjinlist) {
if([objisKindOfClass:[UIViewclass]]) {
UIImageView*imageView=(UIImageView*)obj;
NSArray*list2 = imageView.subviews;
for(idobj2inlist2) {
if([obj2isKindOfClass:[UIImageViewclass]]) {
UIImageView*imgView = (UIImageView*)obj2;
if(CGRectGetHeight([imgViewframe]) ==0.5) {
_navLine = (UIImageView*)obj2;
break;
}
}
}
}
}
_navLine.hidden= hidden;
}
}
//设置导航栏背景色
UINavigationBar * bar = self.navigationController.navigationBar;
UIImage *image = [UIImage imageWithColor:[UIColor colorWithHex:0x444550]];
[barsetBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
网友评论