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)