这个伪代码的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
方法尝试它,它会检测到触摸,但我无法将其设置为特定于对象。感谢
P.S。我想在触摸UIPickerView
时在显示屏上显示提示。
答案 0 :(得分:1)
这只是我的头脑......但你应该能够理解......
- (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: