In Objective-C, what is the equivalent of Java's “instanceof” keyword?

前端 未结 3 604
走了就别回头了
走了就别回头了 2020-12-12 12:29

I would like to check whether an object (e.g. someObject) is assignable (cast-able) to a variable of another type (e.g. SpecifiedType). In Java, I

3条回答
  •  死守一世寂寞
    2020-12-12 12:42

    See the isKindOfClass: method in the NSObject documentation. (The usual word of warning for such question is that checking the object class is often a sign of doing something wrong.)

提交回复
热议问题