标签: uisnapbehavior

减缓UISnapBehavior

我正在使用一个UISnapBehavior,但它的速度太快了,我不喜欢.有没有办法减慢速度?或者换句话说:有没有办法调整物体的弹性以及它应该捕捉的点?

ios7 uidynamicbehavior uisnapbehavior uikit-dynamics

8
推荐指数
1
解决办法
2163
查看次数

UISnapBehaviour 仅在 x 轴上

有没有办法让 UISnapBevahiour 只沿着线性 x 轴工作?

我想要 UISnapBehaviour 的确切行为,但不希望它在 x 和 y 轴上“摇动”到位置,而只是在 x 轴上摇动。

这是针对表格单元格的 contentView 内的 UIView 的。

// UIKitDynamics
self.animator = [[UIDynamicAnimator alloc] initWithReferenceView:self];
CGPoint centerPoint = self.contentView.center;
self.snapBehaviour = [[UISnapBehavior alloc] initWithItem:self.frontView snapToPoint:centerPoint];
[self.snapBehaviour setDamping:1.0f];
[self.animator addBehavior:self.snapBehaviour];
UIDynamicItemBehavior *itemBehaviour = [[UIDynamicItemBehavior alloc] initWithItems:@[self.frontView]];
itemBehaviour.elasticity = 0.0f;
itemBehaviour.allowsRotation = NO;
[self.animator addBehavior:itemBehaviour];
Run Code Online (Sandbox Code Playgroud)

ios uisnapbehavior uikit-dynamics

2
推荐指数
1
解决办法
1038
查看次数