斯威夫特:如何在故事板上的按钮的一个角落绕过?
I know how to round both sides of a UIButton with: myButton.layer.cornerRadius = 10, but I am not sure how to round just one side so it would look something like this:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您无法以IB进行操作,通常的方法是通过用户定义的运行时属性设置属性或手动设置属性。
但是,设置A角半径,但仅在某些角度需要设置具有值的图层蒙版阵列([.layerminxminyCorner,.layerminxmaxycorner]))),IB中不支持。
另一个选项是编写一个Uibutton的子类,该子类在INIT方法中设置这些值(尤其是INIT(编码器:)),然后在IB中更改以将该类用于视图。
I don't think you can do it in IB, the usual way to do it would be to either set properties or manually via the User Defined Runtime Attributes.
However, setting the a corner radius but only for certain corners requires setting the layer maskedCorners array with values ([.layerMinXMinYCorner, .layerMinXMaxYCorner]) and that is not supported in IB.
The other option would be to write a subclass of UIButton that sets those values in the init method (particularly the init(coder:)) and then change in IB to use that class for the view.
将此扩展名用于您的项目
以调用Roundcorners方法
参考
如果您需要为所有视图组件使用扩展
更改
扩展名Uibutton
to扩展名Uiview
Use this extension into your project
to call roundCorners Method
Reference
If you need to use extension for all view components
Change
extension UIButton
toextension UIView