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?
相关问题
- CALayer - backgroundColor flipped?
- What uses more memory in c++? An 2 ints or 2 funct
- Core Data lightweight migration crashes after App
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
相关文章
- 现在使用swift开发ios应用好还是swift?
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- How can I add media attachments to my push notific
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
if all you want to do is test an object to see if it's a type of a certain Class
NSStringFromClass([instance class])
should do the trick.From within the class itself
Just add a category:
Then use the following code:
or even:
To use it anywhere add the category to YourProject.pch file.
OBJC:
SWIFT
From instance:
From type:
If you are looking how get classname in Swift you can use reflect to get information about object.