views:

250

answers:

1

What programming tips / tricks have you learned for styling views on the iPhone?

As an example, you can set the background color of a view to an image:

[myView setBackgroundColor:[UIColor colorWithPatternImage: [UIImage imageNamed:@"view-background.png"]]];

+1  A: 

I've created a bunch of custom views on the iPhone, and I generally design them in Adobe Fireworks before trying to create them in IB or XCode. Firework's native format is PNG, so it's easy to jump between the images and the simulator, and adjust them to make the view look good.

As far as creating the actual views, I'd recommend using a UIImageView as the base class for any view that needs a custom background image. Also, to make a view transparent or semi-transparent, you need to set both opaque=NO and backgroundCoor = [UIColor clearColor].

Hope that helps!

Ben Gotow