POWERED by FUSION

My name is Jake Marsh. I'm a developer, designer, and writer.


Subscribe via RSS or Twitter.

#ios Posts

GAJavaScript

Posted

Been wanting something like this for a long time. GAJavaScript is a Cocoa Touch library that makes working with JavaScript from inside native code much more tolerable, maybe even fun.

JavaScript is accessed from Cocoa Touch using UIWebView. GAJavaScript has the concept of a "script engine", which provides the primary interface to the JavaScript runtime inside the UIWebView. Essentially, the UIWebView is an implementation detail of this library, but you may want to manage the UIWebView instance used by the script engine.

Some might say it's a nasty hack, but in certain situations I can see this totally coming in handy. I work on a product regularly that needs to facilitate complex communication between remote web view content and local native code, and boy, I really wish I'd known about this library back when I started that project.

GAJavaScript was built by Andrew Goodale and if you like it you should definitely take a look at one of his other projects, GAViewStyling which is a neat little library letting you style UIView objects with CSS style declarations.

Accessing Image Properties Without Loading the Image

Posted

I see this type of stuff a lot in other people's code:

UIImage *image = [UIImage imageWithContentsOfFile:@"lolcats.jpg"];
CGSize imageSize = image.size;

It's certainly not wrong, but you are incurring a huge performance and memory usage hit just to get the width and height of an image. Enter the CGImageSource... methods.

As of iOS 4, the SDK includes a better solution in the form of the CGImageSource... set of functions, which have been available on the Mac since forever. These functions allow you to access certain image metadata without having to load the actual pixel data into memory.

Ole Begemann has put together a great article explaining the ways around such performance hits, and how you can get pretty much any metadata you could want about an image, without incurring a performance or memory usage hit.

Subtle Design Changes in iOS 5

Posted

I always find it fun to try to spot all the tiny design differences in Apple's user interfaces whenever a new update comes out.

A blog called Design Archive has put together some comparison shots of iOS 4 and iOS 5 highlighting some of the more fun differences. Normally I would quote the site I'm linking to, but this one is in Japanese, and Google Translate doesn't exactly offer grammatically readable sentences either, so here's a few of the fun ones they found:

Badge Shadow

Home Icon Space

I love that Apple's designers revisit things like this so often.