What prevents the appearance of a UITableView index?

I have a UITableView, with a SearchBar that has a visible ScopeBar. I used all the necessary delegation and data source methods to support table indexes. However, when a table view is displayed, section indexes are not displayed. When a table of search results is displayed, section indicators are displayed.

I implemented a code snippet from this answer and confirmed that the main table is, in fact, indexed.

I'm really at a standstill. Logging suggests that everything be in place to have this work, but I can’t understand for life why the main table does not display indexes. And yes, the indexes for the main table are configured; I see them in my protocol.

In the main table, I see that index headers are requested and returned, but not displayed.

The same message is displayed in the search results table (headers are requested and returned) and they are displayed.

It should be noted that, although I do not see how this can lead to indexes not appearing in the table, the SearchBar class is actually a subclass that simply overrides setShowsScopeBar:to force it to YES. I tried my application without this override. Same result: no index in the view of the main table.

Thus, the question arises: what would prevent the index from showing, even if all the necessary delegation methods and a data source to support the indexes are in place (and work even for the search results table, because the methods are called and the index is shown for this view.)

Thank!

+3
source share
1 answer

So, after all these months, here is the solution to this problem.

First, it turned out that -reloadSectionIndexTitlesin iOS 4.3, the SDK still does nothing with respect to (re) displaying section index names in a view. I still need to use -reloadData, which is unsuccessful, but in the end, everything is in order. (Did not try with any new versions of iOS, FWIW ...)

, , . !

, : ? - , ! ( - , .) , , .

, . , . . UISearchBar overrode -searchBar:setShowsScopeBar::

- (void) setShowsScopeBar:(BOOL) show
{
    [super setShowsScopeBar: YES]; // always show!

    [self resignFirstResponder];
}

resignFirstResponder. , , UISearchBar ( , ), (, , ) , . , , , , , , , - . , - - !

resignFirstResonder , , , (-), . , .

. Bizarre.

. , , , , ( UISegmentedControl 2 3 ). , resignFirstResponder, .

, , . , .

+2

All Articles