我有一个 View Controller ,其中包含 UITableView 中的类别列表。我将此 View Controller 插入其他三个 View Controller 中。因此,当调用 tableView 时,就会应用相同的功能,但我不希望发生这种情况.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
self.index = indexPath;
[retrieveName getItemName:[self.arrayForCategories objectAtIndex:indexPath.row]];
[self dismissModalViewControllerAnimated:YES];
[tableView reloadData];
}
此方法仅在从一个 View Controller 调用时才有效。有什么想法吗?
最佳答案
在您要推送的 View Controller 中放置一个属性,该属性决定了它在被选择时应该执行的操作。让插入它的 View Controller 设置该属性。检查您所展示的方法开始处的属性值。
关于iphone - 调用相同的 View Controller 但需要不同的操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10915334/