Friday, 26 October 2012

Quartz Composer Image Composition

I have used Quartz Composer to display messages from for example Twitter.  The raw data I am displaying includes the author's profile image, author's name, message content and the destination of any URL within that message.  I feed that data from a Mac OSX application written in Objective-C as a number of arrays.  This post explains how to take these constituent parts and arrange them within a single image that can then be easily manipulated.

Thursday, 11 October 2012

Objective C Singletons

I was writing my first app in Objective C using Apple's wonderous XCode IDE.  I had two view controllers launched from the nib to control a couple of views.  I needed to send data from one controller to another and had real difficulty.  The problem was that I couldn't use accessors to pass data, as I would prefer, because the viewcontroller objects weren't aware of each other.  After much reading, googling and 'youtube tutorialing' I settled on using a 'Singleton' object.  This great youtube tutorial by barrowclough was particularly helpful.

A Singleton is a custom class you create that can be accessed by any other objects.  It is declared in such a way that different objects instantiate this class they all end up with the same object. This means that the variables/attributes/properties of the Singleton can be get/set by any of those objects.