Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I draw a rounded rectangle Label or View?

I need to draw a rounded rectangle bar in my iOS application, but without using a background image. Is there any way to make a rounded rectangle view or label?

like image 683
Oksana Avatar asked Aug 19 '11 10:08

Oksana


People also ask

What is a rectangle with rounded sides called?

A technical word for this kind of shape is Oblong.


1 Answers

In addition to the other answer(s), don't forget to set the masksToBounds property.

#import <QuartzCore/QuartzCore.h>

label.layer.cornerRadius = 5.0;
label.layer.masksToBounds = YES;
like image 118
Mundi Avatar answered Sep 21 '22 15:09

Mundi