Mat*_*toe 19 cocoa-touch objective-c uilabel touch-event ios
如果有人触及预先声明的话UILabel,我想做一个动作,例如:
if (label is touched) {
my actions;
}
Run Code Online (Sandbox Code Playgroud)
有方法/方法吗?
Wil*_*ith 47
您可以使用手势识别器:
- (void)someSetupMethod {
// ...
label.userInteractionEnabled = YES;
UITapGestureRecognizer *tapGesture = \
[[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(didTapLabelWithGesture:)];
[label addGestureRecognizer:tapGesture];
[tapGesture release];
}
- (void)didTapLabelWithGesture:(UITapGestureRecognizer *)tapGesture {
// ...
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
21221 次 |
| 最近记录: |