【问题标题】:UISearchDisplayController changing frameUISearchDisplayController 改变框架
【发布时间】:2013-12-28 06:13:40
【问题描述】:

我在我的 ViewController 中使用 UISearchDisplayController:

搜索栏是我的 tableView 的一部分:

一切正常(搜索,搜索结果),但我有一个问题:当我按下搜索她时它变大了,在我按下取消按钮后它改变了他的位置并返回到初始位置,请检查这个Picture。我错过了什么?我只是将我的 searchDisplayController 与故事板连接起来,并使用一些代码进行搜索,我没有改变我的 searchBar 的大小或位置。

【问题讨论】:

  • 此搜索字段是您的表格视图的一部分?
  • 是的,请检查更新
  • 尝试移除 searchDisplayController 并只添加 searchBar
  • 我想使用搜索显示控制器,因为我在 searchDisplayController 中更新了我的 searchResultsTableView
  • 您是手动更改表格视图的大小吗?

标签: ios iphone objective-c xcode


【解决方案1】:

在 viewDidLoad 中设置 edgesForExtendedLayout 对我有帮助:

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) 
    self.edgesForExtendedLayout = UIRectEdgeLeft | UIRectEdgeBottom | UIRectEdgeRight;
else
    [self respondsToSelector:@selector(edgesForExtendedLayout)];

警告:这仅适用于 iOS >= 7

来源:

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多