-
Notifications
You must be signed in to change notification settings - Fork 19
Description
If you use NSLayoutConstraints properly, you can make the knob control resize continuously on rotation. But if you have shadows and use a shadow path (by setting the middleLayerShadowPath, foregroundLayerShadowPath and/or knobRadius properties), the shadow will not transform continuously with the control, which doesn't look very nice. You'll have to adjust it after the rotation is complete. If you don't use a shadow path, everything works fine, but the performance is not as good.
It is possible to animate the shadowPath property of a CALayer. Getting this right probably means something like:
override func willRotateToInterfaceOrientation(toInterfaceOrientation: UIInterfaceOrientation, duration: NSTimeInterval) {
super.willRotateToInterfaceOrientation(toInterfaceOrientation, duration: duration)
let frame = computeNewFrameForKnobControl()
knobControl.setFrame(frame, duration: duration)
}With a new setFrame:duration: selector, you could properly animate the control with a rotation and in general animate the shadow path along with any change to the control frame.
A fix for this may wait until after the control moves to the Violation framework.