【发布时间】:2015-05-31 09:18:21
【问题描述】:
假设我的 ViewController 上有一个或多个 100*50 的矩形按钮。
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func myButton(sender: UIButton) {
}
}
通常我把我的图形图像作为他们的图像。然后我应用自动布局。
但是!我需要它们倾斜而不是水平,即如果你有一个正方形,我需要将它旋转成菱形(45°),它是一样的。 我知道通过界面生成器是不可能的。如何通过代码实现?
也许我应该使用 CGAffineTransformRotate 或 RotateTranform 但我真的不知道如何开始
【问题讨论】:
-
你可以添加一个简单的图像使其更清晰吗?
-
3轴旋转:CATransform3DMakeRotation()
-
已编辑,也许更清楚一点
标签: ios swift button ios8 rotatetransform