相关疑难解决方法(0)

辅助动作segue(UITableViewController)

我正在尝试通过IB制作segue,在tableView中按下单元格附件时切换视图.

来自我IB的图片:

1.我从tableviewcontroller的单元格拖动到另一个视图并选择Accessory Action - > push

IB截图

当我运行我的项目时,我得到错误:

[setValue:forUndefinedKey:]:此类不是密钥值编码兼容的关键附件ActionSegueTemplate

我认为这可能与单元格的reuseIdentifier有关.

我的cellForRowAtIndexPath:方法:

static NSString *CellIdentifier = @"champion cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

NSString *cellIconName = ((championList *)[self.champions objectAtIndex:indexPath.row]).championImage;
UIImage *cellIcon = [UIImage imageNamed:cellIconName];
[[cell imageView] setImage:cellIcon];

cell.imageView.frame = CGRectMake(0.0f, 0.0f, 70.0f, 70.0f);

cell.imageView.layer.cornerRadius = 7;
[cell.imageView.layer setMasksToBounds:YES];

cell.textLabel.text = ((championList *) [self.champions objectAtIndex:indexPath.row]).championName;
cell.detailTextLabel.text = ((championList *) [self.champions objectAtIndex:indexPath.row]).championId;

return cell;
Run Code Online (Sandbox Code Playgroud)

我可以使用performSegueWithIdentifier:方法作为此问题的解决方案,但我想弄清楚为什么我在IB中遇到辅助操作问题.

iphone xcode objective-c uitableview ios

17
推荐指数
1
解决办法
1万
查看次数

标签 统计

ios ×1

iphone ×1

objective-c ×1

uitableview ×1

xcode ×1