- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CI= @"GenusNameCell";
GenusNameCell *cell = [tableView dequeueReusableCellWithIdentifier:CI];
if (cell == nil) {
cell = [[GenusNameCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"GenusNameCell"];
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
}
int row = [indexPath row];
cell.GenusNameLabel.text = [genusName objectAtIndex:indexPath.row];
cell.GenusCommonNameLabel.text = _genusCommonName[row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
SpeciesViewController *Species = [[SpeciesViewController alloc] initWithNibName:@"SpeciesViewController" bundle:nil];
if ([[genusName objectAtIndex:indexPath.row] isEqual:@"Abelia"]) {
Species.SpeciesInt = 0;
[Species setTitle:[genusName objectAtIndex:indexPath.row]];
}
}
我有2个tableviews连接,但我不知道这是否是正确的代码来做到这一点。它运行的时候,当我点击它崩溃的单元格。有人能帮我吗?如何从桌面推到桌面
那你为什么要包含这段代码,而不是'didSelectRowAtIndexPath:...'中的代码? –
你有没有实现的 - (空)的tableView:(UITableView的*)的tableView didSelectRowAtIndexPath方法:(NSIndexPath *)indexPath – Jared
- (空)的tableView:(UITableView的*)的tableView didSelectRowAtIndexPath方法:(NSIndexPath *)indexPath { SpeciesViewController *核素= [ [SpeciesViewController alloc] initWithNibName:@“SpeciesViewController”bundle:nil]; if([[genusName objectAtIndex:indexPath.row] isEqual:@“Abelia”]) { Species.SpeciesInt = 0; [Species setTitle:[genusName objectAtIndex:indexPath.row]]; } – user3228210