Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UITableView does not bounce/scroll after UISearchBar is added to view

I have a UITableView filled with rows of data. There are only 3 or 4 rows of data which do not reach the bottom of the screen, but the table still bounces vertically as expected when swiping up and down. After adding a UISearchBar to the top row/header of the UITableView in Interface Builder, the table no longer bounces initially. However, after navigating to a different view and returning to the same view, the table once again bounces. Why does the UITableView not bounce when the view is initially loaded, and how do I make it so that it does bounce?

- (void)viewWillAppear:(BOOL)animated {
    [table reloadData];
    [super viewWillAppear:animated];
}

- (void)viewDidLoad {
    ...
    [table reloadData];
    [super viewDidLoad];
}

- (void)viewDidUnload {
    ...
    self.table = nil;
    [super viewDidUnload];
}
like image 968
epaps Avatar asked Jan 19 '23 10:01

epaps


1 Answers

I was able to solve this problem by implementing the answer on this question.

The key was to add self.tableView.bounces = YES in the viewDidLoad method.

like image 105
epaps Avatar answered May 07 '23 05:05

epaps