swift - Animated resizing of a NSView does not effect layer. Bug or totally correct? -
i have 2 nsview subclasses:
drawrectview
draws background color using drawrect methodlayerbackedview
draws background color using layer backing
the following code snippet resizing animation via click actions on views:
@ibaction func clickdrawrectview(sender: nsclickgesturerecognizer) { let height = drawrectview.frame.height * 1.2 let width = drawrectview.frame.width * 1.2 nsanimationcontext.runanimationgroup({ (context) in context.duration = 1.0 self.drawrectview.animator().frame = nsmakerect(self.drawrectview.frame.origin.x, self.drawrectview.frame.origin.y, width, height) }, completionhandler: nil) } @ibaction func clicklayerbackedview(sender: nsclickgesturerecognizer) { let height = layerbackedview.frame.height * 1.2 let width = layerbackedview.frame.width * 1.2 nsanimationcontext.runanimationgroup({ (context) in context.duration = 1.0 self.layerbackedview.animator().frame = nsmakerect(self.layerbackedview.frame.origin.x, self.layerbackedview.frame.origin.y, width, height) }, completionhandler: nil) }
the drawrectview animates expected, layerbackedview not. jumps next rect animation.
so how bring same animation layer-backed view?
Comments
Post a Comment