我想做一个干净的白色设计。所以,我将tintColor
属性设置为whiteColor
,但在UINavigationBar
和UISearchBar
下有这些黑线。删除导航栏/搜索栏底部的黑线
做一些人知道,如何去除黑暗的线条或如何改变颜色?
我想做一个干净的白色设计。所以,我将tintColor
属性设置为whiteColor
,但在UINavigationBar
和UISearchBar
下有这些黑线。删除导航栏/搜索栏底部的黑线
做一些人知道,如何去除黑暗的线条或如何改变颜色?
这是我做的,似乎工作,它是这个环节的进一步发展。我改变了明确的宽度声明一个动态的,所以,这将是该视图的大小,如果你改变视图大小与否:
UIView *overlayView = [[UIView alloc] initWithFrame:CGRectMake(0, 43, self.view.frame.size.width, 1)];
[overlayView setBackgroundColor:[UIColor whiteColor]];
[navBar addSubview:overlayView]; // navBar is your UINavigationBar instance
[overlayView release];
添加方法的UIImage按类别
+ (UIImage *)imageWithColor:(UIColor *)color {
CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return theImage;
}
和刚刚成立
[self.navigationController.navigationBar setShadowImage:[UIImage imageWithColor:[UIColor whiteColor]]];
从iOS 7 UINavigationBar有一个shadowImage属性,您可以将其设置为nil。
或self.navigationController.navigationBar.shadowImage = [UIImage new]; – Caroline
@Caroline如果在故事板中,如何删除导航栏底线? – aircraft