- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
无论出于何种原因,每当我使用捕捉行为时,它都会导致 UIButton 在“捕捉”时变成各种大小的矩形。我可能只是在看这个问题。我的最后期限是明天,以解决最后的错误,所以我将不胜感激任何帮助!谢谢!
vvv - ViewController.m - vvv
//set points
CGPoint bullyboxPoint = {80, 188};
CGPoint weemPoint = {240, 188};
CGPoint yeaPoint = {80, 339};
CGPoint charityPoint = {240, 339};
CGPoint phhsPoint = {80, 488};
CGPoint experiencePoint = {240, 488};
//make the buttons closer to speed up the snap
bullybox.frame = CGRectMake(40, 788, 120, 120);
weem.frame = CGRectMake(200, 788, 120, 120);
yea.frame = CGRectMake(30, 939, 120, 120);
charity.frame = CGRectMake(190, 939, 120, 120);
phhs.frame = CGRectMake(20, 1328, 120, 120);
experience.frame = CGRectMake(180, 1328, 120, 120);
//create behaviors
UISnapBehavior *snapBehavior = [[UISnapBehavior alloc] initWithItem:self->bullybox snapToPoint:bullyboxPoint];
UISnapBehavior *snapBehavior1 = [[UISnapBehavior alloc] initWithItem:self->weem snapToPoint:weemPoint];
UISnapBehavior *snapBehavior2 = [[UISnapBehavior alloc] initWithItem:self->yea snapToPoint:yeaPoint];
UISnapBehavior *snapBehavior3 = [[UISnapBehavior alloc] initWithItem:self->charity snapToPoint:charityPoint];
UISnapBehavior *snapBehavior4 = [[UISnapBehavior alloc] initWithItem:self->phhs snapToPoint:phhsPoint];
UISnapBehavior *snapBehavior5 = [[UISnapBehavior alloc] initWithItem:self->experience snapToPoint:experiencePoint];
//dampen the snap
snapBehavior.damping = 1.2f;
snapBehavior1.damping = 1.2f;
snapBehavior2.damping = 1.2f;
snapBehavior3.damping = 1.2f;
snapBehavior4.damping = 1.2f;
snapBehavior5.damping = 1.2f;
//add behaviors
[self.animator addBehavior:snapBehavior];
[self.animator addBehavior:snapBehavior1];
[self.animator addBehavior:snapBehavior2];
[self.animator addBehavior:snapBehavior3];
[self.animator addBehavior:snapBehavior4];
[self.animator addBehavior:snapBehavior5];
最佳答案
问题可能是您正在使用自动布局。 Autolayout 和 UIKit Dynamics 是敌人(如果你看一下 Apple 的示例代码,你会发现他们通过关闭 Autolayout 规避了这个问题)。
我喜欢解决这个问题的方法是:制作要动画的对象的快照图像;隐藏实际对象并将快照图像放在其位置;对快照图像进行动画处理;一切结束后,将快照图像从界面中取出并在新位置显示实际对象。
这是有效的,因为快照图像不受自动布局的影响。但是,您仍然需要解决这个问题,因为您无法通过设置其框架
来移动受自动布局约束的按钮;您必须设置他们的约束。
关于ios - UISnapBehavior 导致失真,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23000440/
我正在使用 UISnapBehavior,但它的捕捉速度太快了,我不喜欢。有没有办法让它慢下来?或者换句话说:有没有办法用它应该捕捉的点来调整物体的弹性? 最佳答案 我能够通过将 View 附加到 U
无论出于何种原因,每当我使用捕捉行为时,它都会导致 UIButton 在“捕捉”时变成各种大小的矩形。我可能只是在看这个问题。我的最后期限是明天,以解决最后的错误,所以我将不胜感激任何帮助!谢谢! v
我正在尝试使用 UISnapBehaviour 为 UIButton 设置动画。我关注了Apple References和 Apple Dynamics Catalog ,但不是使用点击手势来启动动画
在我的应用程序中,我有一些小 View ,可以通过拖动它们来移动它们。当用户开始拖动其中一个小 View 时,它会留在原地,但会“拉伸(stretch)”一定距离(~200 点)。超过距离后,小 Vi
我可以通过添加具有阻力的 UIDynamicItemBehavior 轻松地使捕捉更慢。然而,阻力的默认值是 0.0,这对我来说还是太慢了。将阻力设置为负值没有效果,它似乎移动得像 0.0 一样快。
我正在尝试使用 UISnapBehavior 创建一个tweening back 动画。 我正在尝试制作一个可拖动的正方形,然后当正方形被释放时,它会补间回到原来的位置。每次它后退时,它似乎都有一个奇
我正在研究 CS193P,我想创建一种效果,让卡片从 0,0 一个接一个地卡入到位。我试图链接动画,但 View 一起飞行,我也在尝试使用 UIDynamicAnimator 并且发生了同样的事情。所
我正在使用 UIDynamicAnimator 的 UISnapBehavior 在两种状态之间制作这些圆圈的动画: http://cl.ly/image/1G3p1B2x2v14/Image%202
我想弄清楚是否可以在 UIScrollview 中使用 UIAnimator 中的 UISnapBehavior 来使 ScrollView 的内容对齐到一个点。到目前为止,我的发现导致这是不可能的。
我是一名优秀的程序员,十分优秀!