This blog describe a very basic and essential feature that is used in iPhone/iPad Applications.When we normally use label,button etc the shapes are in square form.Of course you can convert it in a rectangle by varying the width and height but the problem occurs when you have to give a rounded shape.
This is what the blog will guide you :-
First you have to add QuartzCore Framework in your project.
Add #import <QuartzCore/QuartzCore.h> in your file.
Now add these lines of code where ever you want to show your control
CALayer *l = [btn layer];
[l setMasksToBounds:YES];
[l setCornerRadius:20.0];
btn is my UIButton .You can change the value of setCornerRadius to give your desired rounded shape.
This is what the blog will guide you :-
First you have to add QuartzCore Framework in your project.
Add #import <QuartzCore/QuartzCore.h> in your file.
Now add these lines of code where ever you want to show your control
CALayer *l = [btn layer];
[l setMasksToBounds:YES];
[l setCornerRadius:20.0];
btn is my UIButton .You can change the value of setCornerRadius to give your desired rounded shape.
No comments:
Post a Comment