I am trying to accomplish this:
Consider a table view with Search Bar on its header.Table view gets refreshed whenever string is searched.
I am having 2 classes
TableViewController(UIViewController subclass)
contains UITableView -That shows the table whose
header view of the table is loaded from the Header class(UIToolBar subclass)
.
Header(header of the UITableView)
-Contains UISearchBar and its delegate
The
UISearchBarDelegates call back a function in TableViewController
that calls
- (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation
which causes App to crash
The function call stack frame is as follows
[UITableView reloadSections:withRowAnimation:]
[TableViewController functionThatCallsReloadSection]
[Header searchBarSearchButtonClicked:]
The reloadSection is causing the App to crash .Any ideas why its happening so?
Is it because the delegate function is still active on the stack while the the table view header is reloaded??
I am not changing any anything related to the tableview (no change in the number of rows or sections).All i am trying to doing is to just reload the table view.
Edited: I am trying to do all these things in iPad,which provides a popover while using UISearchDisplayController which i dont want to use.I already have a table view which i want to refresh once the text is entered and search button is hit,using the search delegate. The only problem is that once i call [UITableView reloadSection:] in the search delegate of UISearchBar(UISearchBar is located on the header of the UITableView that i want to reload) the app crashes.
I was able to fix the problem by using the tableViewHeader instead of loadind the table view header using the table view header delegate method where i used a pointer thats initialised to the table view header.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With