I'm trying to make segue via IB, that switching views when pressed cell accessory in tableView.
Images from my IB:
1.I'm dragging from cell of tableviewcontroller to another view and selecting Accessory Action -> push
and when i'm running my project i get error:
[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key accessoryActionSegueTemplate
I think that this might be something wrong with reuseIdentifier of cell.
My cellForRowAtIndexPath:
method:
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;
I can use performSegueWithIdentifier: method as solution of this problem, but i want to figure out why i having problem with accessory action in IB.
I had this problem when I had ctrl-dragged a segue from the detail accessory button of the prototype cell to the next view controller. So instead I did the drag from the table view controller itself, and added a bit of code to it.
Objective-C:
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
[self performSegueWithIdentifier: @"EditUser" sender: [tableView cellForRowAtIndexPath: indexPath]];
}
Swift 3.0:
func tableView(_ tableView: UITableView, accessoryButtonTappedForRowWith indexPath: IndexPath) {
performSegue(withIdentifier: "EditUser", sender: tableView.cellForRow(at: indexPath))
}
This works for iOS 5.0 - 10.x
I'm getting this error when I run my application on iOS 5 on an iPod Touch and not on iOS 6 on an iPhone 5.
The docs say that accessory action was deprecated in iOS 3.0. The bug seems to be that it's being shown and allowed in iOS 6.
Can you confirm what version of iOS you're testing against?
https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITableViewCell_Class/DeprecationAppendix/AppendixADeprecatedAPI.html#//apple_ref/occ/instp/UITableViewCell/accessoryAction
I just ran into the same problem. Works fine on iOS 6, crashes on 5.1.
The way I solved it is by using a standard UITableViewCell
and creating the accessory button out of a UIButton
, on which I put a segue.
On iOS 5.x, this error also occurs when you create a popover style segue in a storyboard, and (in my case) anchor it to a UITableViewCell.
In this case, the error message is a completely misleading red herring.
I'm assuming that iOS 5.x doesn't support anchored popover segues.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With