【发布时间】:2013-07-31 04:33:19
【问题描述】:
这是一个非常常见的问题,虽然我有谷歌并交叉检查我的代码几次,但我无法找出崩溃
*** -[MyCustomCell performSelector:withObject:withObject:]: message sent to deallocated instance 0x96f6980
我有一个名为 MyCustomCell 的 CustomCell 和 XIB,其中我有 3 个用于 Facebook、Twitter、LinkedIn 的按钮。我在 CustomCell 类中给了他们所有的 IBAction。
当我点击其中任何一个时,我都会遇到这种崩溃。
我正在使用 ARC。
在我的 ViewController 类中,我有 cellForRowAtIndexPath
{
static NSString *CellIdentifier = @"MyCustomCell";
MyCustomCell *cell = (MyCustomCell*)[myTableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:CellIdentifier owner:self options:nil];
cell = (MyCustomCell *)[nib objectAtIndex:1];
}
return cell;
}
MyCustomCell.m
- (IBAction)facebookPressed:(BaseButton *)sender {
}
- (IBAction)twitterPressed:(BaseButton *)sender {
}
- (IBAction)linkedInPressed:(BaseButton *)sender {
}
【问题讨论】:
-
那些按钮事件写在哪里?你真的把所有的动作都绑定到他们身上了吗?
-
@Roshni 你能添加按钮操作的代码吗?
-
按钮事件写在 MyCustomCell 类中
-
@Roshni 也粘贴该代码..你能加载自定义单元格吗?
-
是的单元格正在加载。它只是与给定消息崩溃的点击事件
标签: iphone objective-c uitableview custom-cell