Saya mencoba mengambil sedikit bahasa Swift dan saya bertanya-tanya bagaimana cara mengubah Objective-C berikut menjadi Swift:
- (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
}
}
Lebih khusus lagi saya perlu tahu cara menggunakan isKindOfClass
sintaks baru.
override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
???
if ??? {
// your touch was in a uipickerview ...
}
}