- (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