小编lke*_*hll的帖子

将isKindOfClass与Swift一起使用

我想尝试一下Swift lang,我想知道如何将以下Objective-C转换为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
    }
}
Run Code Online (Sandbox Code Playgroud)

更具体地说,我需要知道如何isKindOfClass在新语法中使用.

override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {

    ???

    if ??? {
        // your touch was in a uipickerview ...

    }
}
Run Code Online (Sandbox Code Playgroud)

reflection introspection ios swift

225
推荐指数
3
解决办法
11万
查看次数

标签 统计

introspection ×1

ios ×1

reflection ×1

swift ×1