我遇到了这个问题,不知道怎么解决
在 mainstoryboard 中,我为 Top Bar 设置了 auto top layout 为 20 首先,我的搜索栏(顶部栏)的 y 位置是 84,但看起来像这样,我一直想要我的应用程序
但是,当我选择搜索栏时,我使用 func searchBarTextDidBeginEditing(searchBar: UISearchBar)
显示另一个栏,但即使另一个没有显示,我的搜索栏(顶部栏)也会移动下来,我看起来一点都不好,但现在是 y 位置:20 ??
这是它的样子
那么,有人可以帮我解决这个问题吗??非常感谢
最佳答案
在 viewDidLoad 方法中试试这个
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
{
self.automaticallyAdjustsScrollViewInsets=YES;
self.edgesForExtendedLayout = UIRectEdgeNone;
self.navigationController.view.backgroundColor = [UIColor whiteColor];
self.navigationController.navigationBar.translucent = YES;
}
关于ios - 布局问题 Xcode - 搜索栏自动移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41208316/