UIButton w/ gradient, rounded corners, border, and drop shadow

后端 未结 3 1079
生来不讨喜
生来不讨喜 2020-12-13 00:46

There are a few similar questions on the site, but I\'m looking for something specific and slightly different.

I followed the direction given here: http://www.cimgf.

3条回答
  •  清歌不尽
    2020-12-13 01:36

    Instead of inserting a gradient layer, you can also override the method +layerClass to return the CAGradientLayer class. The layer of the button is than of that class, and you can easily set its colors etc.

    + (Class)layerClass {
        return [CAGradientLayer class];
    }
    

提交回复
热议问题