我在实现文件中使用了下面的代码。问题是,当我点击一行时,它不会将我带到另一个视图?其他视图尚未加载iPhone应用程序
请帮助
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 3;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.text = [NSString stringWithFormat:@"Vehicle List %d", [indexPath row]+1];
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.vehic == nil) {
Vehicle *vehicle = [[Vehicle alloc] initWithNibName:@"Vehicle" bundle:[NSBundle mainBundle]];
self.vehic = vehicle;
}
[self.navigationController pushViewController:self.vehic animated:YES];
}
如果你把一个NSLog里面'didSelectRow ...'代码执行?而Vehicle是UIViewController的子类? –
给一些关于车辆和车辆物体的信息... – mAc