One of the missing features in Xcode is the hability to add code sense for protocol methods that can be implemented by a class, for example a class that extends UITableViewController, these classes may have a custom implementation of methods found on both UITableViewDelegate or UITableViewDatasource protocols, the signature of these methods isn’t so easy to memorize and some code completion at this point would help a lot.
Today I finished an article to a local magazine about mobile development, this article gives a small introduction on iPhone development with iPhone SDK, this article covers the development of a simple application that perform some meansure conversion. One of learned things was how to do number formatting with NSNumberFormatter like we have below:
NSNumber *result = [NSNumber numberWithFloat: 0.0];
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
NSString resultText = [[[numberFormatter stringFromNumber:result];
In this example I’m setting the number format to show a float number with 5 decimal positions and using comma as decimal separator since this is the brazilian decimal separator. I could convert and format a NSNumber by just passing it as argument to stringFromNumber method of NSNumberFormatter instance. Not so different from Java, right?
Last sunday I finished the development of my first iPhone application, I could do this by using Xcode and Interface Builder, the last beta of iPhone SDK comes with good integration between these two tools, but there are some components missing on Interface Builder, like UIDatePicker and UISlider, I can bypass it for now.