- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用 UIDynamicsAnimator 取得了良好的效果,只是动画完成后,插入和弹起的图像变得模糊。请帮助我。
@property (nonatomic,weak) IBOutlet UIImageView *someImage;
self.animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view];
self.gravity = [[UIGravityBehavior alloc] initWithItems:@[self.someImage]];
CGVector gravityDirection = {-1.0, 0.5};
[self.gravity setGravityDirection:gravityDirection];
self.collision = [[UICollisionBehavior alloc] initWithItems:@[self.someImage]];
self.collision.translatesReferenceBoundsIntoBoundary = YES;
self.itemBehaviour = [[UIDynamicItemBehavior alloc] initWithItems:@[self.someImage]];
self.itemBehaviour.elasticity = 0.5;
[self.animator removeAllBehaviors]; // to avoid problems from the last behaviour animation
[self.collision addBoundaryWithIdentifier:@"barrier"
fromPoint:CGPointMake(444,0)
toPoint:CGPointMake(444,768)];
self.pushBehavior = [[UIPushBehavior alloc] initWithItems:@[self.someImage] mode:UIPushBehaviorModeInstantaneous];
self.pushBehavior.magnitude = 1.0f;
self.pushBehavior.angle = 0.0f;
[self.animator addBehavior:self.pushBehavior];
self.pushBehavior.pushDirection = CGVectorMake(1.0f, 0.0f)
self.pushBehavior.active = YES;
[self.animator addBehavior:self.itemBehaviour];
[self.animator addBehavior:self.collision];
[self.animator addBehavior:self.gravity];
最佳答案
我认为你的问题是动画完成时图像没有位于精确的点上。我建议您添加一个委托(delegate),当动画暂停时,您将图像的 x 和 y 舍入为最接近的整数。
关于ios - 使用 UIDynamicAnimator 后图像模糊,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24002748/
我遇到了与 https://stackoverflow.com/questions/28275004/uidynamicanimator-stop-reacting-to-uigravitybehav
我正在尝试向 UIGravityBehavior 添加一个 View (我通过 cmd 将其创建为图形+将其拖动到我的代码并创建一个 Outlet)但是我的应用程序崩溃了,尽管当我在代码中创建相同的
我正在尝试手动更改 UIDynamics 中的 View 旋转,但 View 的旋转总是在更新后重置。 documentation说,UIDynamicAnimator的updateItemUsing
我在使用 initWithItem:attachedToItem: 时遇到问题 初始化连接一个动态项的中心点到另一个动态项的中心点的附件行为。但是当我使用方法 pan 改变 topview 的中心点时
我使用 UIDynamicsAnimator 取得了良好的效果,只是动画完成后,插入和弹起的图像变得模糊。请帮助我。 @property (nonatomic,weak) IBOutlet UIIma
我是自动布局的新手。我有一个 View 层次结构可以很好地与自动布局一起工作。 我有一个显示菜单的容器 View 。我正在使用 Dynamics 为这个 View 设置动画以产生流行效果: View
我想放慢由我的 UIDynamicAnimator 生成的动画,以便我可以微调我的 UIDynamicBehaviors。 在 ios 模拟器中,调试菜单下有一个菜单选项,标签为“在最前面的应用程序中
我在 Xcode 7 中工作,应用程序适用于 IOS 9。目标是使用 UIDynamicAnimator、UIGravityBehavior 和 UICollisionBehavior 让圆形物体表现
我知道 sprite kit 是玩游戏的方式,但我想知道是否有办法使用 UIDynamicAnimator 来设置除重力之外的额外恒定力。我正在制作平台游戏并将重力设置为向下。我有部分屏幕设置来表示箭
我定义了 UIDynamicAnimator 属性: lazy fileprivate var animator: UIDynamicAnimator = { return UIDyn
您将如何暂停和恢复 UIDynamicAnimator 的物理模拟?无法以编程方式暂停和恢复。当所有项目都处于静止状态时会出现“暂停”状态,但我正在寻找不同的东西。例如,我想让一个物体被重力场拉动,然
在使用 Xcode 5.1.1 在 iOS7 中使用新的物理引擎时,我编写了以下代码: #import "ZViewController.h" @interface ZViewController (
我想使用 UIDynamicAnimator 和重力/碰撞/弹性效果来制作放下物体的动画。我查看了 Apple 的示例应用程序 DynamicsCatalog , 它非常简单,除了当对象从其容器边界外
我正在尝试读取我的设备运动,特别是设备处于横向模式时的滚动,并将返回的角度转换为 UIView 的位置(基本上是在屏幕上制作“级别”以向用户显示手机处于理想角度)。 此代码给出了所需的滚动结果,但由于
我正在阅读 O'Reilly 的 Swift Development with Cocoa 并收到以下错误: Bound value in a conditional binding must be
我有一个 ViewController,它已在 InterfaceBuilder 中配置为对其所有 subview 使用 AutoLayout。布局工作正常。 我想使用 UIDynamicAnimat
我正在玩 UIKitDynamics ,它真的很整洁。目前我有这段代码: CGPoint center = [newSelectedLabel center]; [self.animator remo
我正在尝试创建一个 View ,其中一些项目沿正常重力矢量落下,而其他项目沿相反矢量落下 self.animator = [[UIDynamicAnimator alloc] initWithRefe
我有一个名为 DropitBehavior 的类,它继承自 UIDynamicBehavior。我的 UIViewController 中有两个属性。 @property (strong, nonat
当调用 applicationDidEnterBackground 时,如何停止 UIDynamicAnimator?另外,如何在 applicationWillEnterForeground 中启动
我是一名优秀的程序员,十分优秀!