Objective C - 数组中对象的索引

时间:2016-07-25 10:10:36

标签: ios objective-c arrays

我有一个名为" team"和所有类的项目称为" teamType"。在我的方法中,我想检查" teamType"的对象索引。来自"团队"的索引阵列:

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

teamType *te = [[teamType alloc]init];
//here I want to check te's index depending on the indexpath 


[[NSUserDefaults standardUserDefaults]setObject:[te Name] forKey:@"buttonSelected"];
}

1 个答案:

答案 0 :(得分:0)

teamType *te = teams[indexPath.row];