i want animate uiview uiimageview in it. code below it's seams correct uiview.frame value animation assign in second run. have no idea why that. in second run animation want to.
code
private func animatetopreviewmode(){ let y = uiscreen.mainscreen().bounds.height * 0.2 let width = uiscreen.mainscreen().bounds.width let height = uiscreen.mainscreen().bounds.height * 0.4 let frame = cgrectmake(0, y, width, height) previewimageview.image = stillimage frameforcapture.hidden = true previewview.hidden = false println("run") println("target frame \(frame)") println("preanimation\(previewview.frame)") uiview.animatewithduration(1.5, delay: 0, usingspringwithdamping: 0.5, initialspringvelocity: 1, options: uiviewanimationoptions.beginfromcurrentstate, animations: { () -> void in println("pre set \(self.previewview.frame)") self.previewview.frame = frame println("post set\(self.previewview.frame)") }) { (complete) -> void in //complete //all buttons enabled println("complete: \(self.previewview.frame)") } }
view hierarchy
output
target frame (0.0, 113.6, 320.0, 227.2) preanimation(0.0, 0.0, 320.0, 568.0) pre set (0.0, 0.0, 320.0, 568.0) post set(0.0, 113.6, 320.0, 227.2) complete: (0.0, 0.0, 320.0, 568.0) run target frame (0.0, 113.6, 320.0, 227.2) preanimation(0.0, 0.0, 320.0, 568.0) pre set (0.0, 0.0, 320.0, 568.0) post set(0.0, 113.6, 320.0, 227.2) complete: (0.0, 113.6, 320.0, 227.2)
update
if turn previewimageview.image = stillimage
works expected. -.-
Comments
Post a Comment