搜索栏在变为活动状态时被导航栏隐藏 [英] Search bar getting hidden by navigation bar when becomes active

查看:105
本文介绍了搜索栏在变为活动状态时被导航栏隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我面临一个奇怪的场景,我在我的应用程序中使用了一个搜索栏,并将其与表视图绑定,如下图所示!

I am facing a weird scenario, I have used a search bar in my application and tied it up with a table view as is seen in the below image!

但是当我尝试的时候要搜索任何搜索栏向上滑动并被导航栏隐藏的内容,我已多次使用搜索栏,从未见过我这样的事情就是它的屏幕截图!

But when ever I try to search anything the search bar slides up and gets hidden by navigation bar, I have used search bar a number of times and never seen me thing like this below is its screen shot !

我可以'我删除了导航栏,因为我需要它,但我无法弄清楚为什么或如何发生,

I can't remove the navigation bar since I need it, but I just can't figure out why or how it can be happening,

需要注意的一点是搜索栏并且它的控制器在尝试搜索时工作得很好,只是它被隐藏在导航栏后面,

One point to note is that the search bar and it's controller are working perfectly when tried to search, only thing is it's getting hidden behind the navigation bar,

任何对此的帮助都会受到赞赏,因为我可以'找出原因。

Any help on this would be appreciated, as I just can't figure out its reason.

推荐答案

试试这个:

将导航栏的半透明属性设置为NO:

Set the navigation bar's translucent property to NO:

self.navigationController.navigationBar.translucent = NO;

此行将修复视图在导航栏和状态栏下方的框架。

This line will fix the view from being framed underneath the navigation bar and status bar.

如果您必须显示和隐藏导航栏,请在 viewDidLoad

If you have to show and hide the navigation bar, then use this code in viewDidLoad

 if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
    self.edgesForExtendedLayout = UIRectEdgeNone;   // iOS 7 specific

这篇关于搜索栏在变为活动状态时被导航栏隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆