[TIMOB-3479] Selecting a row in TiUITableView causes rows at regular intervals to also be selected (allowsSelection)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-21T09:54:18.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Sprint 2011-16 |
Components | iOS |
Labels | n/a |
Reporter | Jolon |
Assignee | Reggie Seagraves |
Created | 2011-04-15T03:45:44.000+0000 |
Updated | 2011-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
File | Date | Size |
---|---|---|
app.js | 2011-04-15T03:45:44.000+0000 | 271 |
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