iOS 8 - 搜索显示控制器在右侧显示白色 space
iOS 8 - Search display controller shows white space at right
在应用程序中使用搜索显示控制器,它在 iOS 7 中工作正常,但在 iOS 8 中它在搜索显示右侧显示白色 space table如下
尝试了很多但没有得到任何解决方案。
这可能是因为layoutMargins。尝试将此方法添加到您的 table 视图的委托中,看看是否按预期工作:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
// Remove seperator inset
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
// Prevent the cell from inheriting the Table View's margin settings
if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
[cell setPreservesSuperviewLayoutMargins:NO];
}
// Explictly set your cell's layout margins
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}
在应用程序中使用搜索显示控制器,它在 iOS 7 中工作正常,但在 iOS 8 中它在搜索显示右侧显示白色 space table如下
尝试了很多但没有得到任何解决方案。
这可能是因为layoutMargins。尝试将此方法添加到您的 table 视图的委托中,看看是否按预期工作:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
// Remove seperator inset
if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
[cell setSeparatorInset:UIEdgeInsetsZero];
}
// Prevent the cell from inheriting the Table View's margin settings
if ([cell respondsToSelector:@selector(setPreservesSuperviewLayoutMargins:)]) {
[cell setPreservesSuperviewLayoutMargins:NO];
}
// Explictly set your cell's layout margins
if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
[cell setLayoutMargins:UIEdgeInsetsZero];
}
}