我有一个带有两个静态单元格的 TableView Controller 。单击每个 View 时,应打开一个预定 View 。如果更容易理解的话,每个单元格的行为都应该像选项卡栏中的一个元素一样。我尝试使用推送转场将每个单元格连接到其 View ,但看起来当我这样做时, Storyboard正在设置整个表格的推送。
如何将每个单元格连接到打开的唯一 View ?
(我愿意在常规 View Controller 上使用 2 个按钮(而不是表格)来实现这一点。)
最佳答案
在你的类中采用 UITableViewDelegate 协议(protocol),并实现
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if ((indexPath.section == customSection) && (indexPath.row == customRow))
{
// Your custom action here
}
}
关于ios - 如何告诉静态单元格在 Xcode 中打开特定 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11317468/