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, August 13, 2013

iOS String to Integer

So, you want to convert an NSString to NSInteger, eh?

The easiest way to go from NSString to NSInteger is by using the NSString:intValue method, like so:
NSString *theString = @"99";
NSInteger *intResult = [theString integerValue];


Now, lets say you want to convert an NSInteger to NSString:
NSString *myString = [NSString stringWithFormat:@"%i", intResult];


And there you have it. An easy way to convert an NSString to an NSInteger and back again.




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: http://www.blindnsdate.com

Popular Posts

Designed By Seo Blogger Templates