如何制作圆形的椭圆形按钮? [英] How to make a rounded oval button?

查看:115
本文介绍了如何制作圆形的椭圆形按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是使按钮看起来像这样:

My goal is to make my button look like this:

减按钮周围的黑色边缘。

minus the black edges around the button.

阅读了很多文章之后,我看到大多数解决方案都说要使用

After reading quite a few posts, I see most solutions saying to use

layer.cornerRadius = 10.0

当我这样做时,我得到这个:

When I do that I get this:

它使边缘变圆,但没有达到我想要的目标。

It rounds the edges, but doesn't give me my desired goal.

有任何建议吗?

推荐答案

Swift 3

myButton.layer.cornerRadius = myButton.frame.height / 2

myButton.backgroundColor = UIColor.blue
myButton.clipsToBounds = true
myButton.tintColor = UIColor.white
myButton.setTitle("Connect With Facebook", for: .normal)

< a href = https://i.stack.imgur.com/v9JW3.png rel = noreferrer>

这篇关于如何制作圆形的椭圆形按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆