tags:

views:

21

answers:

1

The kind of thing I want to do would be to write a program that takes as input top color, bottom color, and button dimensions. The program would then put in a border and spit out the button.

I found Da Button Factory which is not bad, but also not quite good enough for a couple of reasons:

(1) I want multiple borders, i.e. a black outer border around a lighter inner border (whose color is tied to the color of the button), with the main button inside of that.
(2) I want to be able to play with the colors more easily than their interface allows. In particular, they have me setting top color and bottom color. But what I really want to do is set overall color and gradient. The outputs are the same, but my way lets me play with the parameters much more easily.
(3) I have to enter the dimensions each time. As a combination of this and #2 and the need to download each time, the loop to make each button is a little longer than I would like. I am likely to try out a lot of different buttons before I get ones I really like.

I don't mind coding this myself if there are no tools out there that do quite what I want, but I would want to do it in objC because that's the only language I really know.

I should add that UIImage-compatible formats other than PNG would be OK.

Any suggestions?

Thanks

A: 

What I ended up doing was creating the button backgrounds as ObjC views. I then converted the views to NSData objects, then saved those data objects to files. Here is the method of my UIView object that created the NSData:

-(NSData *) dataRepresentation {
    UIGraphicsBeginImageContext(self.bounds.size);
    [self.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    NSData *data = UIImagePNGRepresentation(image);
    return data;
}
William Jockusch