我在Playground中摆弄我的MKMapView
,我无法动画它的frame.size.height
。这是我的游乐场代码:MKMapView不遵守动画延迟
let vc = UIViewController()
vc.view.backgroundColor = UIColor.whiteColor()
XCPlaygroundPage.currentPage.liveView = vc
let map = MKMapView(frame: vc.view.frame)
map.backgroundColor = UIColor.redColor()
map.autoresizesSubviews = false
vc.view.addSubview(map)
UIView.animateWithDuration(2.0, delay: 1.0, usingSpringWithDamping: 0.5, initialSpringVelocity: 1.0, options: .CurveEaseInOut, animations: {
map.frame.size.height = 200
}, completion: nil)
您可以通过观察地图的红色背景颜色来判断实际动画何时发生。可见地图的高度在MKMapView
的高度之前下降。设置autoresizesSubviews = false
似乎没有做任何事情。那么为什么看起来好像有两个不同的动画呢?
UPDATE在我的游乐场,我打消了我所有的MKMapView
子视图,以及_MKMapContentView
,一个地图的两个子视图的(另一个是“法律” MKAttributionLabel
),已被删除,只有它是红色的背景渲染MKMapView
。所以_MKMapContentView
被调整为子视图,但调用map.autoresizesSubviews = false
没有做到这一点。是什么赋予了?
谢谢,但那不是我问的。我只是使用红色背景作为例子。我问为什么看起来好像有两个动画。 – chicobermuda