Friday, June 7, 2013

UITableView sectionIndexMinimumDisplayRowCount example in Objective C (iOS).


UITableView sectionIndexMinimumDisplayRowCount

The number of table rows at which to display the index list on the right edge of the table.

@property(nonatomic) NSInteger sectionIndexMinimumDisplayRowCount

Discussion of [UITableView sectionIndexMinimumDisplayRowCount]
This property is applicable only to table views in the UITableViewStylePlain style. The default value is zero.

UITableView sectionIndexMinimumDisplayRowCount example.
self.tableView = [[[UITableView alloc] initWithFrame:CGRectMake(0, 0,
320, 480 - 20)
                                                                                                   style:UITableViewStylePlain] autorelease];
        self.tableView.autoresizingMask =
    UIViewAutoresizingFlexibleWidth |
UIViewAutoresizingFlexibleHeight;
        self.tableView.sectionIndexMinimumDisplayRowCount = 2;
        [self.view addSubview:self.tableView]; 

Example of [UITableView sectionIndexMinimumDisplayRowCount].
The UISearchBar is the headerView of the TableView. I want the strange stuff on the side moved down by the height of the SearchBar, or completely removed.

I figured out, that you can remove the bar with

self.tableView.sectionIndexMinimumDisplayRowCount = 1337;


End of UITableView sectionIndexMinimumDisplayRowCount example article.