简体   繁体   中英

tableview cell selection in iPhone

I am getting tableview cell as not selected when i scroll the tableview either in up and down direction. How should i use following method in code?

[tableview selectRowAtIndexPath:animated:scrollPosition];

How should i use following method in code?

[tableview selectRowAtIndexPath:animated:scrollPosition];

Example : Add a new cell on the tableview and scroll the table up to added cell added:

NSArray *indexPaths = [NSArray arrayWithObjects: [NSIndexPath indexPathForRow:[self.yourDataSource count]-1 inSection:0],nil];
[self.myTableView beginUpdates];
[self.myTableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationTop];
[self.myTableView endUpdates];
[self.myTableView scrollToRowAtIndexPath:indexPaths atScrollPosition:UITableViewScrollPositionTop animated:YES];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM