1
我試圖在我的圖層轉換時追蹤幀中的更改。動畫是可見的,但不知何故我的框架屬性設置爲(0,0,0,0)之前的動畫和之後。我沒有明確設置任何框架屬性,但我認爲它是基於BezierPath設置的,因爲您知道......該圖層可見且正在工作,所以它的框架不應該是(0,0,0,0)。發生什麼了?可見圖層的(CAShapeLayer)幀是零 - Swift
//in viewDidLoad()
var shapeLayer: CAShapeLayer!
shapeLayer = CAShapeLayer()
shapeLayer.lineWidth = 2
shapeLayer.strokeColor = UIColor.redColor().CGColor
shapeLayer.fillColor = UIColor(red: 0.1, green: 0.3, blue: 0.6, alpha: 0.3).CGColor
shapeLayer.path = UIBezierPath(ovalInRect: CGRectMake(40, 40, 100, 100)).CGPath
println("\(shapeLayer.frame)")
shapeLayer.contentsScale = UIScreen.mainScreen().scale
view.layer.addSublayer(shapeLayer)
//when button is pressed
shapeLayer.transform = CATransform3DMakeScale(2, 1, 3)
println("\(shapeLayer.frame)")