ko1o / PYSearch

🔍 An elegant search controller which replaces the UISearchController for iOS (iPhone & iPad) .
MIT License
3.83k stars 752 forks source link

用一个UINavigationController包了searchViewController,present出来后,出现如图问题 #215

Closed CCBrother closed 5 years ago

CCBrother commented 5 years ago

问题描述

用一个UINavigationController包了searchViewController,present出来后,出现如图问题,页面会置顶了

代码如下: self.searchNav = [[UINavigationController alloc] initWithRootViewController:searchViewController]; [self presentViewController:self.searchNav animated:NO completion:nil];

重现步骤

图片

预期结果

实际结果

受影响的设备

版本信息

ko1o commented 5 years ago

@CCBrother 可能是iOS 11.0以后 tableview的问题,试试添加一下代码:

    if (@available(iOS 11.0, *)) {
        [UITableView appearance].estimatedRowHeight = 0;
        [UITableView appearance].estimatedSectionFooterHeight = 0;
        [UITableView appearance].estimatedSectionHeaderHeight = 0;
        [UITableView appearance].contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
        [UIScrollView appearance].contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    }
CCBrother commented 5 years ago

还是不行,看视图,tableview没问题,是历史记录的那个view,上移了

CCBrother commented 5 years ago

加一句这个 self.searchNav.navigationBar.translucent = NO; 就可以了,导航栏问题