我有一个 tableView,我在一个单元格上创建了一个 Button。
UIButton *deleteGroupButton = [UIButton buttonWithType:UIButtonTypeCustom];
[deleteGroupButton setFrame:CGRectMake(218, 12, 40, 60)];
[deleteGroupButton addTarget:self action:@selector(deleteGroupButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
当我单击按钮时,该消息出现异常:
“由于未捕获的异常 'NSInvalidArgumentException' 导致应用程序终止,原因:'-[Group deleteGroup:]: unrecognized selector sent to instance 0x5a8afc0'”
这就是我的 deleteGroupButtonClicked 方法
- (void) deleteGroupButtonClicked: (id) sender {
Groups *tmpGroups = [[Group alloc] init];
NSInteger tmp = appDelegate.selectedGroupId;
[tmpGroups deleteGroup:tmp];
[tmpGroups release];
}