iphone 自定义色彩的 圆角矩形

iphone 自定义颜色的 圆角矩形

首先选择button的type为customer

然后设置背景色

这个时候会发现界面显示的是直角矩形

此时在界面代码的界面初始化方法中 增加此矩形的圆角设置

first of all import this in your .m file -

#import <QuartzCore/QuartzCore.h>

and then in your loadView method add following lines

    yourButton.layer.cornerRadius = 10; // this value vary as per your desire
    yourButton.clipsToBounds = YES;