我有一个自定义单元格,上面有一个按钮。我想尝试使用长按。
创建单元格的代码如下所示:
CustomCell *cell = (CustomCell *)[aTableView dequeueReusableCellWithIdentifier:@"CustomCell"];
if (!cell)
{
cell = [[[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil] lastObject];
}
(ETC)
所以我这样做了:
CustomCell *cell = (CustomCell *)[aTableView dequeueReusableCellWithIdentifier:@"CustomCell"];
if (!cell)
{
// cell = [[[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil] lastObject];
cell = [[[NSBundle mainBundle] loadNibNamed:@"CustomCellDwellToSpeak" owner:self options:nil] lastObject];
}
然后我复制了原始的xib。删除了按钮。在单元格上放置一个 UILongPressGestureRecognizer,并通过从识别器向文件所有者控制拖动来创建目标:
- (IBAction)longPress:(UILongPressGestureRecognizer *)sender;
但是,一旦我开始生成单元格,就会出现以下错误:
TypOHD[41541:c07] -[UILongPressGestureRecognizer label]: unrecognized selector sent to instance 0x17d0be60
那是怎么回事?