我一直试图删除navigationBars边框没有运气.我已经研究过,人们似乎告诉将shadowImage和BackgroundImage设置为nil,但这在我的情况下不起作用.
我的代码
self.navigationController?.navigationBar.barTintColor = UIColor(rgba: "#4a5866")
self.navigationController?.navigationBar.setBackgroundImage(UIImage(named: ""), forBarMetrics: UIBarMetrics.Default)
self.navigationController?.navigationBar.shadowImage = UIImage(named: "")
Run Code Online (Sandbox Code Playgroud)
插图:

是否可以在iOS7中更改UINavigationBar的灰色边框底部颜色?
我已经尝试删除到边框,但这不起作用:
[[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]];
Run Code Online (Sandbox Code Playgroud)
谢谢!
我试图将导航栏放在另一个导航栏下方,使其看起来像一个高大的导航栏.但是在iOS 7中,UINavigationBar现在在其顶部和底部都有内部阴影.我真的需要删除它.但我没有找到任何解决方案.它看起来像预渲染的阴影,但实际上它在视图出现后大约0.4秒内缓慢出现.
我几乎尝试了所有东西,但阴影依旧存在.我用以下代码删除了栏下方的水平线:
for (UIView *view in [[[self.navigationController.navigationBar subviews] objectAtIndex:0] subviews]) {
if ([view isKindOfClass:[UIImageView class]]) view.hidden = YES;
}
Run Code Online (Sandbox Code Playgroud)
但我无法弄清楚如何去除阴影.非常感谢!
我试过这个:
[self.navigationController.navigationBar setShadowImage:[[UIImage alloc] init]];
Run Code Online (Sandbox Code Playgroud)
但该代码甚至不会删除栏下方的水平线(此方法需要自定义背景图像).我用Xcode 5.0(5A11365x)
所以我有一个导航栏,它有一条水平线,我想删除.
我从屏幕截图中删除了导航栏颜色,使线条更加明显.
我已经尝试将导航栏的阴影图像属性设置为空白png(1x1像素pngs为1x,2x和3x),但没有效果.
这变成了一次大规模的冒险,随后又变成了一个非常大而凌乱的帖子,因此,为了使您不必阅读下面我键盘发keyboard的混乱情况,以下为摘要:
主要目标:寻找一种在我的应用程序中有选择地显示导航栏的方法,而不必也有选择地删除“安全”区域填充以防止我的内容被iPhone X槽口夹住。
为什么要这样做:我想尝试使用导航栏的内置安全区域填充而不是react-native填充,<SafeAreaView>因为这<SafeAreaView>会干扰内置填充并导致标题不必要地过高。
不按标准方式进行操作的副作用:标头(与一起显示在图片中height: 0)和内容之间存在一条细线,当标头和内容颜色相同时,该行清晰可见
我试了一下:
<SafeAreaView><SafeAreaView>尝试header: null(也称为“推荐的方法”)使用标题选项可以使标题消失而不会导致剪切的内容。作为副作用(引自下面的扩展帖子)
我还发现
header: null在功能上与headerTransparent: 'true'后来发现的结果相同,在 功能上也与相同display: 'none'。所有这些似乎都是使整个标头,安全区域填充等全部消失的有效方法。
使用borderColor和borderWidth确定是否是边界(事后看来,我应该更彻底地做到这一点)
position: 'relative', top: 6这很清楚地将答案引向了答案,因此我将在此处将其截断并在答案中继续进行。
我在我的react-native项目(使用CRNA创建)中使用了react-navigation,我想我已经找到了一种样式化标头的方法,StackNavigator以便iOS为您照顾安全区域,并消除了使用<SafeAreaView>(这会干扰其他屏幕上的标题)。
我的应用程序的排列方式是,第一个屏幕有点像主屏幕,带有一个网格的按钮,最终每个按钮在都有自己的页面StackNavigator。在此主屏幕上,我想禁用标题栏,因为没有导航到的内容,它只是将内容向下移动,但是,在其他屏幕上,我希望显示标题栏以显示后退按钮。使用时,<SafeAreaView>我只能得到上面提到的两个之一,或者主屏幕被iPhone X上的缺口剪断了,或者<SafeAreaView>向下移动了其他屏幕上的导航/标题栏并占用了空间。
但是,我发现通过<SafeAreaView>完全放弃,我可以使用react-navigation中的标头样式重新创建我想要的内容:
App.js
const Navigation = createStackNavigator({
Home: HomeScreen,
Test: PageScreen,
},
{
headerMode: 'screen', …Run Code Online (Sandbox Code Playgroud) 我开发了iPad应用程序.我用导航控制器在popover中打开一些屏幕.但我没有在IOS 7中更改导航控制器色调颜色.如何更改此颜色.感谢名单

UINavigationController *navigationController = [[[UINavigationController alloc] initWithRootViewController:airportsSearch] autorelease];
navigationController.navigationBar.barTintColor = [UIColor blackColor];
navigationController.navigationBar.translucent = NO;
self.popOver=[[UIPopoverController alloc] initWithContentViewController:navigationController];
self.popOver.delegate = self;
[self.popOver setPopoverContentSize:CGSizeMake(285, 370)];
[self.popOver presentPopoverFromRect:tempButton.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
Run Code Online (Sandbox Code Playgroud) 我想UINavigationBar用阴影替换默认边框.有没有办法实现这个目标?我尝试使用与向UIView添加阴影相同的方法,但它增加了我的NavigationBar的高度.
我有UITableViewController一个UISearchDisplayController和UISearchBar.当我在视图中呈现视图时,我在导航栏下面看到一条白线UITabBarController.当我以模态方式呈现视图时UINavigationController,该行是灰色或黑色(我无法分辨),它看起来非常正常.有任何想法吗?

我正在创建一个iOS 7应用程序,我希望在NavigationBar下面有一个SearchBar,我希望它们看起来像一个单件.因此,我需要使用相同的颜色(已经完成)对它们进行着色并删除NavigationBar底部和SearchBar顶部的发际线.我怎样才能做到这一点?
我的tableView中有一个UISearchController.另请注意,顶部有一个导航项.我的问题是,当我加载页面时,我的顶部和底部都有黑色边框,但是,当我单击搜索栏时,它不存在.
页面加载时搜索栏(带黑色边框):
单击搜索栏(无黑色边框)后:
这是相关的代码:
let searchController = UISearchController(searchResultsController: nil)
Run Code Online (Sandbox Code Playgroud)
在viewDidLoad中:
searchController.searchBar.barTintColor = UIColor.redColor()
searchController.searchBar.tintColor = UIColor.whiteColor()
Run Code Online (Sandbox Code Playgroud)
我遵循了几个类似的问题,并在上述行之后进行了以下更改viewDidLoad():
1) searchController.searchBar.backgroundImage = UIImage()
2) searchController.searchBar.searchBarStyle = UISearchBarStyle.Minimal
3) searchController.searchBar.layer.borderColor = UIColor.clearColor().CGColor
4)
searchBar.layer.borderWidth = 1
searchBar.layer.borderColor = UIColor.whiteColor().CGColor
Run Code Online (Sandbox Code Playgroud)
没有用.这是我使用代码的顺序的问题,或者我将如何摆脱这些线?
我正在写viewDidLoad()同样的
self.navigationController?.navigationBar.shadowImage = UIImage()
Run Code Online (Sandbox Code Playgroud)
但是,这不适用于<11版的iOS版本。无论iOS版本如何,为了删除阴影图像我都应该怎么做。
ios ×9
ios7 ×5
swift ×5
iphone ×2
objective-c ×2
border ×1
colors ×1
react-native ×1
shadow ×1
swift3 ×1
uikit ×1
uisearchbar ×1
xcode ×1
xcode5 ×1