我想做一個乾淨的白色設計。所以,我將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