此伪代码的 Xcode 代码是什么?
if ([Any UIPickerView in my ViewController isTouched]) {
[AnyUIView setHidden:NO];
}
if ([Any UIPickerView in my ViewController is__NOT__Touched__Anymore__]) {
[AnyUIView setHidden:YES];
}
尝试使用-(void)touchesBegan
方法,它检测触摸,但我无法使其特定于对象。谢谢
附言我想在触摸 UIPickerView
时在显示屏上显示提示。
最佳答案
这只是我的想法......但你应该能够明白......
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesBegan:touches withEvent:event];
UITouch *touch = [touches anyObject];
if ([touch.view isKindOfClass: UIPickerView.class]) {
//your touch was in a uipickerview ... do whatever you have to do
}
}
..并对 touchesEnded:withEvent:
关于ios - 检测 Xcode 中某个对象的触摸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8880462/