[英]Remove the dark Line at the bottom of Navigationbar/Searchbar
I want to make a clean white Design. 我想做一个干净的白色设计。 So, I set the
tintColor
property to whiteColor
, but there are these dark Lines under the UINavigationBar
and UISearchBar
. 因此,我将
tintColor
属性设置为whiteColor
,但是UINavigationBar
和UISearchBar
下有这些暗线。
Do some one know, how to remove the dark Lines or how to change the Color? 有人知道如何消除黑线或如何改变颜色吗?
add a method to UIImage by category 按类别向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;
}
and just set 并设置
[self.navigationController.navigationBar setShadowImage:[UIImage imageWithColor:[UIColor whiteColor]]];
This is what I did, and seemed to work, it is a further development of this link. 这就是我所做的,并且似乎可以正常工作,这是此链接的进一步发展。 I changed the explicit width declaration to a dynamic one, so that it will be the size of the view if you change view size or not:
我将显式宽度声明更改为动态声明,因此无论您是否更改视图大小,它都将是视图的大小:
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];
I found the stuff here: How to remove UINavigatonItem's border line 我在这里找到了东西: 如何删除UINavigatonItem的边界线
从iOS 7开始,UINavigationBar具有shadowImage属性,您可以将其设置为nil。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.