Ready to Level-Up?

This just in! If your rusty iOS skills could use some refining, or if you're just starting out and you want to level-up fast, consider signing up for our upcoming iOS Screencasts

New from iOS Rocket Surgery Swift Video Tutorials: The rapidly evolving Apple-iOS ecosystem has just been thrown into tumult with the recent introduction of the Swift Programming Language. Are you ready to finally try iOS development? Are you needing to switch from Objective-C to Swift? Sign up today for our free video courses!
(By the dear folks at Swift Tutorial Videos, a sister company)

Tuesday, December 17, 2013

iOS Get Class for String Name

So, you want to get a Class for a given String class name, eh?

If you're wanting to check the class type of an object, you first need to get the class in question so you can do things like invoking the "isKindOfClass" method. If you don't have a Class reference handy, but happen to know the name of the class, then you're in luck. This little bit of code here will give you back a Class and then you're in business:

  Class dictionaryClass = NSClassFromString(@"NSDictionary");

... well that wasn't so spectacularly hard or interesting, but what if we wanted to create an instance of the NSDictionary class (an object) from this, what do we do then eh? Well, we wrote about the answer here.

If that's all you needed, then best of luck on your coding adventure. Please do give us a +1 while you're here if you found this helpful!

About Me

Easy NSDateFormatter Tool

Save yourself some time in formatting your NSDates to NSStrings, and use the Blind NSDate app, which you can download from iTunes. There's also a website where you can format your NSDates:

Popular Posts

Designed By Seo Blogger Templates