One of the screens of my iPhone application is the UITableView, which has a search bar in the table header. I want the search bar to be hidden until the user pulls it, so I use this line in the viewDidLoad method:
[self.tableView setContentOffset:CGPointMake(0,40) animated:NO];
This displays the tableView correctly with the title scrollable at the top of the screen.
My problem occurs when I try to delete a row using this method:
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:myIndexPath] withRowAnimation:UITableViewRowAnimationRight];
When this line is executed, it correctly shifts the line on the right side of the screen. If the table contains only a few rows, then the table title (with my search bar) scrolls down to fill the space freed up by the new deleted row. I do not want this to happen. I want the title to remain hidden until the user scrolls with his finger.
If the tableView has enough rows to fill the window, the table is filled at the bottom, and the title remains hidden. The problem arises only when the screen is not filled with rows.
Any idea on how I can make UITableView not display the table title when deleting a row?
Application: I found that the same thing happens when I put the UITableViewController in edit mode with the following code:
[self setEditing:NO animated:YES];
It goes into edit mode, displays red βdelete rowβ circles and displays the table title. Maybe this is something with the animation.
source share