Hi I can't hide my table view using [self.autocompleteTableView setHidden:YES];
, but It works on ios 10 but in ios 11 it's not hiding the table view.
Anybody could help me?
There's my code:
-(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];
}
答案 0 :(得分:2)
Try this self.autocompleteTableView.hidden = YES;
insted of [self.autocompleteTableView setHidden:YES];
OR
You will remove tableview
from view by using this
[self.autocompleteTableView removeFromSuperview];
This will work.