文章目录

在xib或者storyboard中,可以给button设置圆角。具体操作步骤如下:

1、切换到xib或者storyboard,选中UIButton对象,打开右侧栏Hide or show the Utilities的Show the Identity inspector,在User Defined Runtime Attributtes中添加2个Key Path:

  • layer.cornerRadius,Type是Number;
  • 和layer.masksToBounds,Type是Boolean;

如图:

运行后效果如下:

文章目录