Is there a way to get a class by name?

后端 未结 2 1536
花落未央
花落未央 2021-01-13 23:51

In Objective-C, is there a way to get a class and send messages to it when you have the name of the class as a string? For example, is there a function func whe

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-14 00:28

    You can use NSClassFromString(NSString className) to get the class object from its name.

    Hope this helps!

提交回复
热议问题