如何在情节提要中制作一个简单的圆形按钮? [英] How to make a simple rounded button in Storyboard?
本文介绍了如何在情节提要中制作一个简单的圆形按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚开始学习iOS开发,找不到如何制作简单的圆形按钮.我找到了旧版本的资源.我需要为按钮设置自定义背景吗?在Android中,我只会使用9补丁,但我知道iOS不具备此功能.
I just started learning iOS development, cannot find how to make simple rounded button. I find resources for old versions. Do I need to set a custom background for a button? In Android, I would just use a 9 patch, but I know iOS does not have this capability.
推荐答案
要在情节提要中执行此操作,您需要在按钮上使用图像.
To do it in the storyboard, you need to use an image for the button.
或者,您也可以在代码中完成该操作:
Alternatively you can do it in code:
btn.layer.cornerRadius = 10
btn.clipsToBounds = true
这篇关于如何在情节提要中制作一个简单的圆形按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文