iOS 7 UISearchDisplayController 问题

标签 ios ios7 uisearchdisplaycontroller

伙计们,我在我的应用程序中使用 UISearchDisplayController,它在 iOS 6 和 5 中运行良好。在 iOS 7 中,我遇到了这个 UI 问题。 enter image description here

搜索栏和表格 View 稍微向上移动,表格中的行也向上移动超过预期范围。有人面临同样的问题吗?

最佳答案

您可以尝试将 UITableViewController 的属性 edgesForExtendedLayout 设置为 UIRectEdgeNone for iOS 7 and above to none 因为默认情况下它是 UIRectEdgeAll。

#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)

- (void)viewDidLoad 
{
    [super viewDidLoad];

    if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) 
        self.edgesForExtendedLayout = UIRectEdgeNone;
}

编辑:

Apple 文档的一些解释 here .

关于iOS 7 UISearchDisplayController 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19005602/

相关文章:

ios - 有什么方法可以在本地存储我的应用程序数据 (Sqlite) 并且我可以在删除或重新安装我的应用程序后访问该数据?

iphone - iOS 7 中状态栏出现在我的 View 边界上方

ios - 后台的 NSURLSession didCompleteWithError

Xcode : Search Bar Filtering

ios - 从 UISearchController 过滤的搜索结果中删除

objective-c - 我可以有一个不是模态呈现的相机吗?如何?

ios - 在 UIWebView 中查找元素

php - 由另一种语言的类创建的 Swift 数组

ios - Cocos2d 调用父方法

iphone - UISearchDisplayController 与网络获取数据的用法