Closed taschmidt closed 5 years ago
Nvm, looks like setting parallaxMotionEffect.viewingAngleY = 0
does the trick.
Actually, this didn't quite get me all the way to what I wanted. There's no more parallax horizontally, but I can still wiggle it side to side. Is there any way to remove that?
Ok, just answering my own question again. I'll leave this for posterity. It finally occurred to me that what I wanted in this instance wasn't actually even a parallax, so trying to make a parallax view do it didn't make much sense.
I ended up just adding my own custom motion effects like so:
if context.nextFocusedView == self {
let effect = UIInterpolatingMotionEffect(keyPath: "center.y", type: .tiltAlongVerticalAxis)
effect.minimumRelativeValue = -8
effect.maximumRelativeValue = 8
self.addMotionEffect(effect)
} else {
self.motionEffects.removeAll()
}
By default, your view allows the parallax effect in all directions. Our designer brought up the fact that, in a vertically scrolling list, Apple uses the parallax effect only when moving up and down as a hint to the user as to the scroll direction. Is there an easy way to achieve this?