【发布时间】:2015-09-20 18:29:39
【问题描述】:
我正在尝试进行视图变换,并且在达到某些点之前具有圆形效果,然后它只会填充一个矩形。这是我正在从事的材料设计项目。所有代码都在 iOS 8 或以上设备上的 Swift 2.0 中。
func helloWorld(sender: UIButton) {
let point = sender.frame.origin
let rippleViewInitFrame: CGRect = CGRect(x: point.x, y: point.y, width: 4, height: 4)
let rippleView: UIView = UIView(frame: rippleViewInitFrame)
rippleView.backgroundColor = UIColor.MDColor.blue
let bounds: CGRect = CGRect(x: 0, y: 0, width: self.view.frame.size.width, height: self.view.frame.size.height)
rippleView.layer.masksToBounds = true
rippleView.layer.cornerRadius = 2
self.view.addSubview(rippleView)
UIView.animateWithDuration(0.5, delay: 0.0, options: .CurveEaseInOut, animations: {
rippleView.transform = CGAffineTransformMakeScale(200.0, 200.0)
rippleView.bounds = bounds
}, completion: {
finished in
print(rippleView.frame.origin.x)
})
}
目前视图刚刚超出屏幕大小。
打印语句返回 -37176 而不是 0。我希望它填满屏幕,仅此而已。
【问题讨论】:
标签: ios swift animation uiview swift2