Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shadows don't always resize properly #25

Open
jdee opened this issue Sep 8, 2014 · 0 comments
Open

Shadows don't always resize properly #25

jdee opened this issue Sep 8, 2014 · 0 comments
Assignees

Comments

@jdee
Copy link
Owner

jdee commented Sep 8, 2014

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.

@jdee jdee self-assigned this Sep 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant