美文网首页
swift中的 isKindofClass

swift中的 isKindofClass

作者: 不要虚度美好的时光 | 来源:发表于2017-12-24 00:26 被阅读0次

The proper Swift operator isis:

if touch.view is UIPickerView {

// touch.view is of type UIPickerView

}

Of course, if you also need to assign the view to a new constant, then theif let ... as? ...syntax is your boy, as Kevin mentioned. But if you don't need the value and only need to check the type, then you should use the is operator.

来自网址


相关文章

网友评论

      本文标题:swift中的 isKindofClass

      本文链接:https://www.haomeiwen.com/subject/xtscgxtx.html