【发布时间】:2014-12-26 05:42:10
【问题描述】:
var button = UIButton.buttonWithType(UIButtonType.Custom) as UIButton
var image = UIImage(named: "myimage.png") as UIImage!
button.frame = CGRectMake(0, 0, 100, 100)
button.setImage(image, forState: .Normal)
我在按钮上设置了一个图像,但我想将其缩放为小于按钮(例如图像应为 50,50)并位于按钮的中心。我如何在 Swift 中做到这一点?
【问题讨论】: