Getting name of the class from an instance

后端 未结 7 2103
不思量自难忘°
不思量自难忘° 2021-01-30 07:45

I have the following problem: I get an instance of a class passed and want to know the name of the class of this instance. How to get this?

7条回答
  •  一生所求
    2021-01-30 08:19

    if all you want to do is test an object to see if it's a type of a certain Class

    BOOL test = [self isKindOfClass:[SomeClass class]];
    

提交回复
热议问题