Hi,

I have a UITableView that has four sections. Sections 0 and 2 have a single row 
each. Sections 1 and 3 have variable numbers of rows.

Each row in sections 1 and 3 has an accessory view set up by the following 
lines in -tableView:cellForRowAtIndexPath:

        UITableViewCell cell;
        cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;

Most of the time, tableView:accessoryButtonTappedForRowWithIndexPath: returns 
the correct value for indexPath.row, but occasionally it returns the next row. 
When the problem occurs with the last row, it seems to return an invalid value.

One of the odd things about this problem is that the rows for which incorrect 
values are returned vary with the point size of the label.text.

tableView:heightForRowAtIndexPath: returns the following value, where 
mw_fontSize is an NSString for the point size of the label.text:

         CGFloat rowHeight;
         rowHeight = [mw_fontSize floatValue] * 2;

I've tried 2.2 and 2.4 for the multiplier. That changes which rows have the 
problem for any given point size, but with 7 to 10 rows in a section, and 
fontSize ranging from 12 to 24, in a variety of fonts, from American Typewriter 
to Zapfino, I have not found a fontSize-multiplier combination that does not 
have at least one row showing the problem. (Actually, the font, itself, seems 
to be irrelevant.)

The rows all show the correct text, and all behave correctly when tapped 
outside the accessory button. In the Simulator, it's very easy to see the 
button darken when pressed, so it's quite clear that the wrong value is being 
returned by tableView:accessoryButtonTappedForRowWithIndexPath:.

The problem occurs with iOS 4.3 and iOS 5.0 simulators for the iPad and iPhone, 
and with my iPhone 3G running iOS 4.2.1.

A Google search found one person complaining about the same problem, which was 
not resolved,

So, my questions are:

1. Is this likely to be an iOS bug that I should report?

2. If not, what am I doing wrong?

3. If so, does anyone know of a workaround?

Thanks,
-- Mike Wright


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to