我有一个UIButton,我已经为它分配了一个UIImage。UIButton在我的UITableViewCell上,只有当我点击UIButton的左上方时,它才会检测到触摸!以前有人遇到过这个问题吗?任何帮助表示赞赏。
这是我的代码:
UIButton *indicatorlabel =
[[UIButton alloc]
initWithFrame:
CGRectMake(280,20,22,22)];
indicatorlabel.tag = INDICATOR_LABEL_TAG1;
UITapGestureRecognizer *tapGesture24449 =[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(labelTapShare:)];
[indicatorlabel addGestureRecognizer:tapGesture24449];
[indicatorlabel setTitle:@"shareit" forState:UIControlStateNormal];
indicatorlabel.showsTouchWhenHighlighted=TRUE;
indicatorlabel.userInteractionEnabled=TRUE;
[indicatorlabel setImage:[UIImage imageNamed:@"Share.png" ] forState:UIControlStateNormal];
[cell.contentView addSubview:indicatorlabel];
没有其他视图覆盖我检查过的 UIButton。
谢谢
对不起,伙计们,我错了,我在同一坐标上创建了另一个 UILabel。