
So, I have been struggling to learn Objective C. Here is a snippet of code that might be helpful. Basically you can use NSString’s initWithFormat method to create a new NSString object and use it just like sprinf function in C
[[NSString alloc] initWithFormat:@”(%f,%f)”,center.x,center.y]
Related posts:
- Twitter + iPhone = MyTweet A simple twitter client using Objective C API provided by...
- Use NSDateFormatter To Create A Countdown App On iPhone Use NSDateFormatter to extract Date components and use it to...
- iPhone SDK 3.0 – Playing with Map Kit – Part 3 This is the 3 part of me Playing with Map...
- How to use SBJSON and TouchJSON In this post I show how to use the two...
- How to add CoverFlow Effect on your iPhone App – OpenFlow Hello all, The main criteria of this post is to...
Related posts brought to you by Yet Another Related Posts Plugin.






















5 Responses
Thanks! I too am learning Objective-C and have been trying to figure out an NSString-style sprintf. This does the trick.
Thanks! This post was very helpful to me
Short and consise, just the way it should be!
mvh roger
[NSString stringWithFormat:@"(%f,%f)",center.x,center.y]
[...] Use initWithFormat [...]
Awesome
Sometimes its faster to use google and see such a blog post instead of search the entire apple documentation ..