如何制作一个圆形的椭圆形按钮?

How to make a rounded oval button?

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

减去按钮周围的黑边。

看了很多帖子后,我看到大多数解决方案都说要使用

layer.cornerRadius = 10.0

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

它的边缘变圆了,但没有给我想要的目标。

有什么建议吗?

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)

你可以这样做(例如,如果你的按钮被称为按钮):

button.layer.cornerRadius = button.bounds.size.height / 2.0