這是很常見的問題,在SO雖然我有谷歌和交叉檢查我的代碼幾次,但我無法弄清楚失事上按鈕的UITableView CustomCell崩潰點擊
*** -[MyCustomCell performSelector:withObject:withObject:]: message sent to deallocated instance 0x96f6980
我有一個CustomCell命名MyCustomCell
與XIB,我有Facebook,Twitter,LinkedIn 3個按鈕。我給他們在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你可以添加你的按鈕動作的代碼。 – icodebuster
按鈕事件寫在MyCustomCell類 – Heena