开发者

how to create a rounded transparent rectangle by using cocoa touch?

I need to create a rounded rectangular box in which there will be 6 buttons in iPhone application. And the rectangular box is transparent. Each button have an image and t开发者_运维技巧ext. And they are also transparent. ( Here transparent means we can see the background image of the box. Sorry for my vocabulary.)

I could not get how to start it. I thought of the following one but,

By using core graphics draw the outside rounded rectangle and then draw inside rectangles like 2x3 grid.

Can I make with this ? Are there any good and easy methods than this. Please give me some idea how to start over with ?

I got the rounded rectangle. Now I need to draw the lines in them to divide it into 6 parts. I used link text How can I get the rectangle context to draw lines ?

Thank you.


If your needs are simple enough you can use CALayer properties.

someView.layer.cornerRadius = 10;
someView.layer.borderColor = [[UIColor redColor] CGColor];
someView.layer.backgroundColor = [[UIColor greenColor] CGColor];
someView.layer.opacity = 0.5;

opacity is equivalent to UIView alpha.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜