Objective c 仅在最左侧检测到UITableViewCell上的UIButton触摸
我有一个UIButton,并为它指定了一个UIImage。UIButton位于我的UITableViewCell上,仅当我点击UIButton的左上方时,它才会检测到触摸!以前有人有过这个问题吗?谢谢你的帮助 这是我的代码:Objective c 仅在最左侧检测到UITableViewCell上的UIButton触摸,objective-c,uitableview,uibutton,Objective C,Uitableview,Uibutton,我有一个UIButton,并为它指定了一个UIImage。UIButton位于我的UITableViewCell上,仅当我点击UIButton的左上方时,它才会检测到触摸!以前有人有过这个问题吗?谢谢你的帮助 这是我的代码: UIButton *indicatorlabel = [[UIButton alloc] initWithFrame: CGRectMake(280,20,22,22)];
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。指示标签。showstouch whenhighlighted=TRUE;使用是,这是第一次观察。感谢您的回答danutz Ch…抱歉,我错了,我在相同坐标处创建了另一个UILabel。您正在将TapGestureRecognitor添加到UIButton。您只需将目标/动作指定给按钮,并使用它捕捉触摸,而不必使用UIgestureRecognitor。