Extending UITextField to Have Validation

I’ve created a subclass of UITextField that adds validation facilities and appearance feedback. The idea is that users are happier when it is clear what is expected from them. If you have fields in a form, say, and some either NEED to be filled out or they NEED to be filled out in a specific … Continue reading Extending UITextField to Have Validation

Simple SVG Parser for iOS

I’ve added a simple SVG Parser for iOS on github. Get it here: https://github.com/jmenter/JMSVGParser Here’s how it works: 1.) Call the class method to get back an array of styled shapes self.shapes = [JMSVGParser parseFileNamed:@”awesome_tiger”] 2.) In your view’s – (void)drawRect:(CGRect)rect method, tell each shape to draw, like this: for (JMStyledPath *styledPath in self.shapes) { [styledPath drawStyledPath]; … Continue reading Simple SVG Parser for iOS

NSString Concatenation Using Categories and NSArray Literals.

A while back I had posted on concatenating NSString objects. Now that we have literal notation, let’s see how much easier and terse we can make this, hmmmm? Here is the category on NSArray: @interface NSArray (StringUtilities) – (NSString *)string; @end @implementation NSArray (StringUtilities) – (NSString *)string; {     return [self componentsJoinedByString:@””]; } @end … Continue reading NSString Concatenation Using Categories and NSArray Literals.

Dot Notation in Objective-C

I’m going to jump right into this contentious issue. There has been a lot written about using dot notation in Objective-C. Before we get into the arguments, let me first show you something from some actual code I’m working on right now: “Normal” bracket notation Objective-C: [fetchRequest setSortDescriptors:[NSArray arrayWithObject:sort]]; Dot notation Objective-C 2.0: fetchRequest.sortDescriptors = … Continue reading Dot Notation in Objective-C

A better UIPickerView

Working on a new/old project. Thought I would wrap my UIPickerView customizations into a self-contained class. Here it is. I’ve improved UIPickerView by adding in presentation and interaction functionality that it should frankly have had from the beginning. Here’s what it does: 1.) Added a (void)show and (void)hide method. This makes the pickerView pop up … Continue reading A better UIPickerView

NSString Concatenation (Category)

Hi folks. Just got back from a trip but I thought I would write you and tell you about this thing. Sometimes, you just want to concatenate a bunch of strings together. There are several ways to do this. You can use stringByAppendingFormat with NSStrings or you can use append with NSMutableStrings. You can also … Continue reading NSString Concatenation (Category)

JSON + iOS 5; GO! (Tutorial)

What is JSON? JSON stands for JavaScript Object Notation. It’s a super lightweight and human readable data format. Go check it out and run back here. iOS 5 includes classes to deal with JSON natively. Which is awesome. Let’s do this! Twitter has a service that gives you recent tweets in JSON format when you … Continue reading JSON + iOS 5; GO! (Tutorial)

Showing and Dismissing a UIPickerView Control

There seems to be no standard way of dealing with UIPickerViews. Sometimes they are attached right to the bottom of the interface and never move around (like in the built-in Clock application.) Other times they fly up from the bottom like the keyboard but are embedded in a UIToolbar or UIActionSheet. I’ve come up with … Continue reading Showing and Dismissing a UIPickerView Control

App-A-Week Challenge Update, also Font Tip! (Also, Snippets!)

PizzaPal has been updated to 1.1 with the following changes: Removed iAds. Added 4th pizza comparator. Yeah, I know, that’s kind of cheap to count that as an app release. Whatever, making an app a week is no picnic. Oh, also, if you do any kind of coding/programming, you should totally check this out: I’ve … Continue reading App-A-Week Challenge Update, also Font Tip! (Also, Snippets!)