Add Rounded Corners and Border to UIView

This is the easiest way to applay rounder corner and border to UIView.
you can use layer property of view to display rounder corner and border

RoundedCorner
 [[myView layer] setCornerRadius:5.0];

 [[myView layer] masksToBounds:YES];


Border and BorderColor:

[[myView layer] setBorderWidth:3.0];
[[myView layer] setBorderColor:[[UIColor redColor] CGColor]];   //Adding Border color.

 Dont forget to add quartz framework to your project and include header.



Please comment below with any comments or questions you may have… 
and also if you like babes or dudes. :]

1 comments:

  1. you have a mistake in your code, instead of :

    [[myView layer] masksToBounds:YES];

    there should be:

    [[myView layer] setMasksToBounds:YES];

    ReplyDelete