ENTRIES TAGGED "rounded corners"
Dress up your UIViews with a few simple tricks
Most developers aren’t great UI designers (although, as with everything, there are exceptions). But there are a few quick tricks that can dress up an app, even if you don’t eat and breathe Photoshop. Let’s look at a simple iPad single-view app with two views, each of which contains a label and a text box.
This is about as Plain Jane as you can get in an application; the only concession to visual appeal that has been made is to use a grey background with white UIViews bounding the labels and text boxes. One easy tweak we can use is to make the UIView corners rounded instead of square, which will lend a bit of flare to the design.
This is actually harder than it should be. To set rounded corners, you need to dig down into the CALayer underneath the view:
self.topView.layer.cornerRadius = 5;
self.topView.layer.borderWidth = 1;
self.topView.layer.masksToBounds = YES;
self.bottomView.layer.cornerRadius = 5;
self.bottomView.layer.borderWidth = 1;
self.bottomView.layer.masksToBounds = YES;
You need to set masksToBounds, because otherwise the corners will not be transparent, and the background color of the view will block whatever is beneath it in the parent view. The resulting view is subtly more classy. You can get more rounding by adjusting the cornerRadius value.
So far, so good. But that solid grey background is kind of blah, so we should dress it up a bit. An easy way to make a background pop is to use a gradient fill, a technique that the aforementioned Photoshop jockeys know and love.