我在實現文件中使用了下面的代碼。問題是,當我點擊一行時,它不會將我帶到另一個視圖?其他視圖尚未加載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