Sorry for that question, but what is the best practice to to find the index of a mutablearray send to a sort tableview ? 1. i create a nsmutablearray with a dictionnary 2. i create a table view with sort my array 3. when i clik on the table v开发者_如何学运维iew, how to find the index of the origin array to modify it ?
Set up the UITableViewDelegate (usually your view controller), and implement the method:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//the index of your mutable array can be found with:
NSUInteger *myArrayIndex = indexPath.row;
}
If your view controller is a UIViewController subclass, and not already set up as the tableview delegate, do so by declaring it in your view controller's .h file
@interface MyViewController : UITableViewController <UITableViewDelegate> {...
If you view controller is a UITableViewController, then it already conforms to this protocol.
精彩评论