美文网首页
在xib中通过kvc设置button的圆角

在xib中通过kvc设置button的圆角

作者: mws100 | 来源:发表于2016-05-27 17:25 被阅读344次

    通过IB中的User Defined Runtime Attributes,它能够通过KVC的方式,配置一些在IB中不能配置的属性,帮助我们编写更简洁的代码。步骤如下:

    1)拖一个button到xib或storyBoard中,设置成custom,设置背景图片

    2)增加kaypath,通过kvc添加button的layer.cornerRadius与layer.masksToBounds两个属性,如图

    附一篇通过代码设置圆角属性的链接:(iOS button设置背景图片后,设置cornerRadius没效果的问题 - 简书)

    相关文章

      网友评论

          本文标题: 在xib中通过kvc设置button的圆角

          本文链接:https://www.haomeiwen.com/subject/pskfdttx.html