Skip to content

{ Category Archives } Software Development

Const CGRect in Objective C

File this under something I just learned from one of our vendors; you can declare const structs like a CGRect in your implementation like this: const CGRect kPlaceholderFrame1 = { .origin.x = 126.0f, .origin.y = 22.0f, .size.width = 180.0f, .size.height = 100.0f };

OSX utility to convert a plist to json

Here’s a new utility  for OSX Lion I threw together to convert a plist file to a JSON file. It takes a single argument, which is an absolute or relative path to a plist file. The output of this application will be a JSON file written in the same directory of the plist. Grab the source […]

Creating a PDF with iOS

CreatePDFExample If you find yourself in the position where you need to generate a report that can be printed from your iOS application, you could either integrate directly with the AirPrint APIs, or you can alternatively generate a PDF file so the report can be emailed as well as printed. This is a relatively easy […]

Objective-C Version String Comparison

Often in code you have to compare two version strings, such as and 1.2. You can not just convert these to fractions since there are multiple periods which do not correlate to a decimal number. The best way I found was to use the build in string comparator with some options. Listed below is […]

Drawing polyines or routes on a MKMapView in iOS4 – Part 3

Get right to it: here’s the sample code With the release of iOS 4, Apple has drastically decreased the complexity involved in rendering shapes, including routes, on a map. In fact, they’ve added an entire set of classes to MapKit specifically designed to help you add shapes to a map. These new classes and protocols […]

Objective-C SHA1 Function for the iPhone

Here’s a nice little function that will generate an SHA-1 hash digest that will match what the php sha1() function will generate if you give it the same input: #import <CommonCrypto/CommonDigest.h> @implementation SHA1 +(NSString*) digest:(NSString*)input { const char *cstr = [input cStringUsingEncoding:NSUTF8StringEncoding]; NSData *data = [NSData dataWithBytes:cstr length:input.length]; uint8_t digest[CC_SHA1_DIGEST_LENGTH]; CC_SHA1(data.bytes, data.length, digest); NSMutableString* output […]

Drawing polyines or routes on a MKMapView (as an MKAnnotationView) – Part 2

It turns out there is a better way to display routes on a map than the last example I gave. The problem with my last example is that the route exists in a layer above the map view, resulting in the line of the route being drawn on top of any annotation views. So pins, […]

Tagged , ,

Using MKAnnotation, MKPinAnnotationView and creating a custom MKAnnotationView in an MKMapView

My last experiment maps on the iPhone using the MKMapView from the iPhone’s MapKit was an example of how to use the MKMapView to display the line of a route on the map. Today’s experiment will demonstrate how to drop pin annotation views, as well as custom annotation views on the iphone’s map by providing […]

Tagged , ,

RemoteIO Audio Unit for FFT based on compressed stream output

Today, I pose a question for other iPhone developers who have a lot of experience working with Audio. The examples I have seen out there performing FFTs on audio have all been based around the same concept from the aurioTouch example code. This code works well for me, however I would like to perform the […]

Drawing polyines or routes on a MKMapView (Using Map Kit on the iPhone)

Apple recently released the 3.0 Beta of their iPhone SDK. One of the most exciting new items in this SDK for me was the addition of the MapKit framework. This new mapping component would allow developers to add maps to their applications that have similar performance and functionality to the Google Maps application that ships […]