IOS 11 : Hide TableView does not working

标签 ios uitableview tableview ios11 ios11.2

嗨,我无法使用 [self.autocompleteTableView setHidden:YES]; 隐藏我的表格 View ,但它适用于 ios 10 但在 ios 11 中它没有隐藏表格 View 。

任何人都可以帮助我吗?

这是我的代码:

-(void) seachBarSetup{

self.autocompleteTableView = [[UITableView alloc] initWithFrame:CGRectMake(self.profileMapSearchBar.frame.origin.x, self.profileMapSearchBar.frame.origin.y + self.profileMapSearchBar.frame.size.height, self.profileMapSearchBar.bounds.size.width, self.view.frame.size.height - self.profileMapSearchBar.bounds.size.height - 64) style:UITableViewStylePlain];

self.autocompleteTableView.estimatedRowHeight = 60.0;
self.autocompleteTableView.rowHeight = UITableViewAutomaticDimension;
self.autocompleteTableView.delegate = self;
self.autocompleteTableView.dataSource = self;
if (@available(iOS 11.0, *)) {
    self.autocompleteTableView.insetsContentViewsToSafeArea = YES;
}

self.profileMapSearchBar.alpha = 0.8;
self.profileMapSearchBar.delegate = self;
[self.view addSubview:self.autocompleteTableView];
[self.autocompleteTableView setHidden:YES];

self.profileMapSearchBar.barTintColor = [UIColor whiteColor];
[self.profileMapSearchBar sizeToFit];

 }

最佳答案

试试这个self.autocompleteTableView.hidden = YES;安装于 [self.autocompleteTableView setHidden:YES];
或者

您将删除 tableview从 View 中使用这个

[self.autocompleteTableView removeFromSuperview];

这将起作用。

关于IOS 11 : Hide TableView does not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48569269/

相关文章:

ios - UITableViewCell 和 UIViewController 的简洁开发模式

ios - 更新一个 ViewController 中的 NSUserDefaults 数据在另一个 ViewController 中更改

ios - 同时滚动两个 UITableView

ios - 在 SWIFT 中自定义 UITableview 的第一行

swift - iOS13上下文菜单点击时如何显示或导航到当前的查看 View

java - 如何通过操作添加列数据以修改其值

ios - 显示没有 segue 的弹出 View Controller

ios - 为什么自定义 UIRefreshControl 类的背景颜色在 Swift 中没有改变?

ios - 当 UITableViewCell 使用 Swift 展开时如何更改 UIButton 图像?

iphone - 如何让 UITableview 在重新加载时转到页面顶部?