Note that there are some explanatory texts on larger screens.

plurals
  1. POiPhone UITableView with UISearchBar and refreshing Section Index
    text
    copied!<p>I have a UITableView with a UISearchBar at the top of it.</p> <p>I also use the Section Index delegate to display ABC...XYZ on the right hand side.</p> <p>Problem occurs when I click on the Search Box and the keyboard comes up from the bottom, the Section Index squashes so only A<em>D</em>...*Z are displayed - when I close the Search and they keyboard goes away, the Index stays in this "squashed" state until I scroll or similar.</p> <pre><code> // animate the searchbar [UIView beginAnimations:nil context:NULL]; CGRect tempRect = [[self searchBar] frame]; tempRect.size.width = 320-kMarginRight; [[self searchBar] setFrame:tempRect]; [UIView commitAnimations]; // animate the search index back into view for (UIView *view in [[self tableView] subviews]) { if ([view respondsToSelector:@selector(moveIndexIn)]) { MovableTableViewIndex *index = (MovableTableViewIndex*)view; [index moveIndexIn]; } } // try a whole load of stuff to try and get the section indexes to draw again properly // none of which work! [searchBar setText:@""]; [searchBar resignFirstResponder]; letUserSelectRow = YES; searching = NO; [[self navigationItem] setRightBarButtonItem:nil]; [[self tableView] setScrollEnabled:YES]; [[self tableView] reloadData]; [[self tableView] flashScrollIndicators]; [[self tableView] sizeToFit]; [[self tableView] zoomScale]; [[self tableView] reloadSectionIndexTitles]; </code></pre> <p>My questions are, has anyone seen this behaviour? Is there a way to redraw the Section Index on the RHS (<code>[[self tableView] reloadData]</code> doesn't do the trick)</p> <p>Thanks a million!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload