Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3479] Selecting a row in TiUITableView causes rows at regular intervals to also be selected (allowsSelection)

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-21T09:54:18.000+0000
Affected Version/sn/a
Fix Version/sSprint 2011-16
ComponentsiOS
Labelsn/a
ReporterJolon
AssigneeReggie Seagraves
Created2011-04-15T03:45:44.000+0000
Updated2011-04-21T16:52:11.000+0000

Description

When allowsSelection = true on a TiUITableView and there are more rows than can be displayed on the screen, selecting a row causes rows at repeated intervals offscreen to also be selected.

An example is attached.

The problem is that a cell's state isn't being properly reset when it is reused, hence when the selected cell goes offscreen it becomes available for reuse resulting in the next drawn cell to be selected.

I believe the cause of this is actually the TiUITableViewCell incorrectly overriding setSelected:.

See http://developer.appcelerator.com/question/116611/impossible-to-comply-with-apple-guidelines-using-titanium"> http://developer.appcelerator.com/question/116611/impossible-to-com... for information and a solution.

In TiUITableView.m setSelected: doesn't call the corresponding method on super:

-(void)setSelected:(BOOL)yn
{
    [super setHighlighted:yn];
    [self updateGradientLayer:yn|[self isHighlighted]];
}

it should be changed to:

-(void)setSelected:(BOOL)yn
{
    [super setSelected:yn];
    [super setHighlighted:yn];
    [self updateGradientLayer:yn|[self isHighlighted]];
}

which fixes the problem.

Attachments

FileDateSize
app.js2011-04-15T03:45:44.000+0000271

Comments

  1. Pedro Enrique 2011-04-21

    I have tested the solution code and it does solve the problem. There is a helpdesk ticket that needs this fix. http://support.appcelerator.com/tickets/APP-156113/homepage

JSON Source