ymobe/rapanui — pull request #80 by sporksmith (2012-10-16 00:47:33+00:00)
Title: Generalize RNFactory.createButton to accept RNObjects in place of image paths

While prototyping, it is nice not to have to actually go off and create image files of the desired dimensions for each button. This changeset modifies RNFactory.createButton to check whether provided images are strings. If so, the old behavior is preserved and the string is assumed to be a path to an image file to use.

Otherwise, it is assumed to be an RNObject. This allows the programmer to procedurally create the button image.

In a semi-related change, I also changed the RNObject:init* functions to return self, for convenience, and to be consistent with initWithImage2.

So now a quick and dirty button can be created like so:

```lua
local button = RNFactory.createButton( RNObject:new():initWithRect( 100, 100, { 100, 100, 100}), {
text = 'foo',
...
}
```