开发者

IPhone: how to draw a simple colored rectangle with interface builder?

开发者 https://www.devze.com 2023-01-16 03:05 出处:网络
I\'d like to draw two different colored rectangles (yes I need two.. it\'s a long story) to use as background开发者_开发技巧. Like a simple two tone background color. How would I do this? The only thi

I'd like to draw two different colored rectangles (yes I need two.. it's a long story) to use as background开发者_开发技巧. Like a simple two tone background color. How would I do this? The only thing I saw that comes close is defining a 'view' with a background color. So maybe I could do two views or something in the background but this seems kind of heavy weight. Either that or just create an image. But I was wondering if you know of a way to create a simple rectangle with a background color via interface builder?

Thanks


I would either use two empty UIViews with different background colors, or a single UIImageView with an image with those two colors. I don't see anything wrong with either option, performance-wise.


You may take UIButton for this purpose.Just drag and drop a Round Rect Button from Tools->Library->UIButton to your Interface Builder.Now Resize the shape of UIButton according to your requirement.Finally set an background image for the color and disable the user interaction.

0

精彩评论

暂无评论...
验证码 换一张
取 消