Converting Illustrator Vector Graphics To Obj-C

Tom Krcha pinged me earlier today to pass along that he has written a tutorial on how to use Drawscript, an extension for Adobe Illustrator, to convert Illustrator vector shapes into Obj-C CoreGraphics code.

The screenshot below shows an image created in Illustrator and the code generated by Drawscript:

The tutorial also includes the Xcode project Tom uses to demonstrate the workings of Drawscript.

Recommendations for iOS Code, Tips and Tricks?

Published an interesting iOS developer related article? Recently bumped into a good iOS or Mac related tip/trick?

Pass along your suggestions: submit an iOS developer tip.

View Images And PDF Files In Realtime With Mac OS X Preview While Debugging iOS Apps

David Dengg recently contacted me with a unique tip that can be quite helpful if you are creating or manipulating UIImage objects and/or PDF files in your iOS app.

The basic idea is to show objects in realtime in the Preview app on your Mac development machine while your application is running in the simulator. Let me show you how this works – in the code below (from yesterday’s post on cropping an image), I create a UIImage object that is cropped from another image:

UIImage *image = [UIImage imageNamed:@"mountains.png"];
 
// Create rectangle from middle of current image
CGRect croprect = CGRectMake(image.size.width / 4, image.size.height / 4 ,
  (image.size.width / 2), (image.size.height / 2));
 
// Draw new image in current graphics context
CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], croprect);
 
// Create new cropped UIImage
UIImage *croppedImage = [UIImage imageWithCGImage:imageRef];
 
CGImageRelease(imageRef);

Continue reading