嗨,我无法使用 [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/