Temporary Cell Select

I have some cells in the form of a table, which usually cannot be selected. The user must use the detail disclosure accessory to push the new controller with the item details.

However, returning to the presentation of the table, I would like to highlight the row so that it is clear where he / she came from. To achieve this, I temporarily set the selectionStyle parameter to blue, select / deselect the row, and then set the selectionStyle parameter to none.

However, since the cell immediately returns to selecting StyleNone, the end result is a gray select / deselect, not a blue one.

1) How can I defer this selection of Style until the selection is canceled? 2) My cell will be temporarily selected for a quick finger at this time - how can I avoid this?

+3
source share
2 answers

You can use simple NSTimer to set the selection style to none after a set time interval like this ...

[NSTimer scheduledTimerWithTimeInterval:1.0f
             target:self
             selector:@selector(methodToSetSelectionStyleToNone:)
             userInfo:nil
             repeats:NO];

... or you can use custom animations for graceful grace

[UIView animateWithDuration:1.0f delay: 0.0f
    animations:^{
        // set your selectionStyleNone here
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    completion:^{

    }
];
0
source

Save your pointer path and use the following code whenever you want (viewWillAppear or another method)

// The reset is saved NSIndexPathin the lower code. Thus, even the user returns from a detailed view that after he finds out which row was chosen by him / her.

-(void)viewWillAppear:(BOOL)animated
{
[tableView1 selectRowAtIndexPath:[NSIndexPath indexPathForRow:4 inSection:0] animated:NO scrollPosition:0]; // you can use this line according your requirements.
}

, .

0

All Articles