in order to get the necessary height of a cell, I implemented a function like
+(CGFloat)rowHeightForTableView:(UITableView*)tableView andObject:(NSObject*)theObject {...}
within the cells.
Since the tableView is one of the parameters, I can check whether it’s a plain or grouped style table and include the resulting width in my calculations. But how should I check if an index is being shown?
You can check if the table view’s datasource responds to the
sectionIndexTitlesForTableView:selector (which a datasource must implement for an indexed table view):If the datasource responds to that selector, actually calling it and checking the result allows for the possibility that the table view is currently returning nil from that method because it doesn’t want to show the index for whatever reason or if the datasource is handling multiple table views (some of which are indexed and some which aren’t).