自定义UITableViewCell委托不调用方法

我在我自定义的UITableViewCell中有两个button。

每个button点击应该调用所需的赛格。

我在这样的单元上设置一个委托:

CustomCell.h

@protocol CustomCellDelegate -(void)seeQuestions; -(void)seeLessons; @end @interface CustomCell : UITableViewCell @property (weak, nonatomic) id <CustomCellDelegate> delegate; - (IBAction)seeQuestions:(UIButton *)sender; - (IBAction)seeLessons:(UIButton *)sender; 

CustomCell.m

 - (IBAction)seeQuestions:(UIButton *)sender { [self.delegate seeQuestions]; } - (IBAction)seeLessons:(UIButton *)sender { [self.delegate seeLessons]; } 

现在,在ViewController类中,我有我的UITableView,显示自定义单元格,我导入CustomCell.h文件,并连接委托

ViewController.h

 #import "CustomrCell.h" @interface ViewController : UIViewController <CustomCellDelegate> @property (strong, nonatomic) IBOutlet UITableView *tableView; -(void)seeQuestions; -(void)seeLessons; @end 

ViewController.m

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:@"CustomCell"]; cell.delegate = self; if (cell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil]; cell = [nib objectAtIndex:0]; } cell.title.text = [NSString stringWithFormat:@"%@",_topicsArray[indexPath.row]]; return cell; } -(void)seeQuestions { [self performSegueWithIdentifier:@"seeQuestions" sender:self]; } -(void)seeLessons { [self performSegueWithIdentifier:@"seeLessons" sender:self]; } 

但是,当我点击button,没有任何反应。 我相信我错过了一些真正明显的事情,但是在几个小时后我盯着我的代码,我似乎无法弄清楚我做错了什么。 有什么build议么 ?