伙计们,我在我的应用程序中使用 UISearchDisplayController,它在 iOS 6 和 5 中运行良好。在 iOS 7 中,我遇到了这个 UI 问题。
搜索栏和表格 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/