【发布时间】:2011-06-27 08:41:22
【问题描述】:
大家好, 这是其中一个应用程序的典型布局。现在我想要单击其中一个视图控制器(表视图)的行,我想更改选项卡的索引。假设我在第三视图,我想移动到第一视图。
我尝试使用导航控制器的didShowViewController 委托方法。似乎它不起作用。您能否建议任何其他方式来做到这一点?
谢谢。
【问题讨论】:
标签: iphone tabs navigation
大家好, 这是其中一个应用程序的典型布局。现在我想要单击其中一个视图控制器(表视图)的行,我想更改选项卡的索引。假设我在第三视图,我想移动到第一视图。
我尝试使用导航控制器的didShowViewController 委托方法。似乎它不起作用。您能否建议任何其他方式来做到这一点?
谢谢。
【问题讨论】:
标签: iphone tabs navigation
只需在 UITableView 的 didSelectRowAtIndexPath 方法中使用下面的代码,那么你只需要设置 Tabbar 的 SelectedIndex 即可。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic may go here. Create and push another view controller.
[self.tabBarController setSelectedIndex:indexPath.row];
}
【讨论】: