Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有*xclass的对象Illustration。使用x,我想将其类名提取到一个字符串中,所以我有@"Illustration". 是否有可能做到这一点?
*x
Illustration
x
@"Illustration"
使用 NSStringFromClass。
NSString* className = NSStringFromClass([x class]); NSString* className = [[x class] description];
您可以使用 NSStringFromClass([x class])