Iphone iOS/Xcode 4:视图赢得';t载荷

Iphone iOS/Xcode 4:视图赢得';t载荷,iphone,xcode,ios,xcode4,Iphone,Xcode,Ios,Xcode4,这真是令人沮丧,因为我已经修补了以前版本的Xcode,以前也做过,但现在玩一个新的应用程序,它不工作的原因 我将应用程序打开到UITableView,并希望在选择单元格后将其加载到详细UIView。然而,当我在iPhone模拟器中选择一个单元格时,它只会高亮显示蓝色单元格,而不会加载视图 下面是我使用RootViewController的代码: -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPa

这真是令人沮丧,因为我已经修补了以前版本的Xcode,以前也做过,但现在玩一个新的应用程序,它不工作的原因

我将应用程序打开到UITableView,并希望在选择单元格后将其加载到详细UIView。然而,当我在iPhone模拟器中选择一个单元格时,它只会高亮显示蓝色单元格,而不会加载视图

下面是我使用RootViewController的代码:

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
WorkoutViewController *workoutViewController;
workoutViewController = [[WorkoutViewController alloc] initWithNibName:@"WorkoutViewController" bundle:nil];
workoutViewController.workoutName = [workouts objectAtIndex:indexPath.row];
[self.navigationController pushViewController:workoutViewController animated:YES];
[workoutViewController release];
workoutViewController = nil;

我将视图链接到WorkoutViewController.xib文件中的文件所有者。当我在@implementation WorkoutViewController输入一个断点时,它确实到达了那个断点,但它到达了@synthesis行,然后直接跳回[self.navigationController…等等];并且永远不会返回WorkoutViewController.m文件。

我猜您没有将ViewController设置为TableView的委托。要进行检查,请打开ViewController xib文件并右键单击
fileowner
。在
引用出口
下,通常将
委托
数据
源连接到
表视图
。如果不是这样,请将
新引用出口
拖到表视图

如果我错了,并且它们都已连接,您可能希望在
didselectrowatinexpath
方法的开头放置一个断点。一旦您选择了一行,调试器是否会停止在那里

还值得一提的是,
@implementation
上的断点通常没有多大意义,您更希望将其放在init这样的方法中。此外,即使您现在使用的是Xcode 4,这也不太可能是问题的原因,它看起来更像是实现问题


希望这有帮助,如果您需要进一步的帮助,请告诉我!

Doh!问题已解决。我忘记将RootViewController放入MainWindow.xib上的导航控制器中。感谢您的回复。

我没有看到您所做的任何错误。也许我们需要看到更多的代码。didSelectRowAtIndexPath正在运行触发了ing(如断点所示),它转到@synthesis的原因是我假设您在workoutViewController中拥有workoutName作为属性。