-sectionLocation, -setSectionLocation:animated: should be public API

Originator:me
Number:rdar://11829507 Date Originated:9 July 2012
Status:Duplicate of 8314308 Resolved:
Product:iPhone SDK Product Version:5.1
Classification:UI/Usability Reproducible:Always
 
Summary:


In iOS 5, UITableViewCell has a private API, consisting of a property accessed through three selectors:

    - (void)setSectionLocation:(int)location animated:(BOOL)animated;

    - (void)setSectionLocation:(int)location;

    - (int)sectionLocation;

These are sent when configuring the cell, and tell it whether it is location at the top, middle, or bottom of a section, or whether it is the only cell in a section. A private enum contains the values 1 - 4 for each of these locations, respectively. In addition, if the cell’s backgroundView or selectedBackgroundView responds to these selectors, the cell will forward the messages to them so they too can know the cell’s location.

Knowing the location is essential when doing custom drawing of a cell or a cell background view, especially within a grouped table view. If the cell or background view knows its own location, it can decide whether to draw rounded corners on the top, or the bottom, or both.


Steps to Reproduce:


1. Implement a custom appearance for cells in a grouped table view.


Expected Results:


A documented, public protocol and corresponding enum exists for these selectors and the sectionLocation values. UITableViewCell is documented as implementing the protocol. UITableViewCell is documented as forwarding the -setSectionLocation: and -setSectionLocation:animated: messages to its backgroundView and selectedBackgroundView, if they implement the protocol.

Implement the protocol in your background view class, and you’re done.


Actual Results:


Roll your own UITableViewController subclass and UITableViewCell subclass that clumsily duplicates this existing (but currently private) feature. Shed a tear for all the other developers throughout history who have needlessly spent hours of their life reinventing their own wheels when beautiful working wheels labelled “private” already exist. Murmur a prayer (dupe this bug report) in the hope that the iOS SDK gods will have mercy, and make the API public.


Regression: N/A


Notes:


Please, please, PLEASE make this public in iOS 6.0 SDK.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!