What is the difference between didselectrowindexpath and willselectrowindexpath on iphone?

Explain the difference between UITableViewdelegate methods :

didDeselectRowAtIndexPath:

-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath  

and

willSelectRowAtIndexPath

-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath 
+5
source share
2 answers

code written in

-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath(NSIndexPath*)indexPath 

runs after selecting a line, and the code is written to

-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath(NSIndexPath*)indexPath 

runs immediately before the selected line.

they are the same as

- (void)viewDidAppear:(BOOL)animated and - (void)viewWillAppear:(BOOL)animated

let me know if you have any kind of confusion.

Thank!

+5
source
Message

willSelectRowAtIndexPathIt is sent to the delegate UITableViewafter the user lifts a finger from touching a specific line to didSelectRowAtIndexPath.

willSelectRowAtIndexPathallows you to either confirm that a particular row can be selected by returning indexPath, or select another row by providing an alternative indexPath.

.

+7

All Articles