首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CGAffineTransformScale在使用UIDynamicAnimator时不发送它的规模

CGAffineTransformScale在使用UIDynamicAnimator时不发送它的规模
EN

Stack Overflow用户
提问于 2013-11-08 21:48:42
回答 1查看 524关注 0票数 3

我只是想了解使用updateItemUsingCurrentState的方法,以及如何将缩放的UIView或UIImageView发送给动画师,这样我就可以在viewDidLoad上有一个大盒子和一个小盒子来进行物理测试。我想学习如何传递这个信息,这样我就可以在其他事件中动态地更改大小。

我看到了updateItemUsingCurrentState是从下面的链接和苹果文档中得到的答案,但是没有什么难的例子来获得一个刻度。UIDynamicAnimator for views with CGAffineTransform

我肯定会发现,我需要改变界限或其他什么,但就目前而言,我只是想通过这个障碍。

代码语言:javascript
复制
@property (strong, nonatomic) IBOutlet UIView *CatBox;

@property (strong, nonatomic) IBOutlet UIImageView *catFishBox;
@property (nonatomic) UIDynamicAnimator* animator;

@property (strong, nonatomic) IBOutlet UIView *wrapperWolfBox;

@end

@implementation CatFishViewController

UIDynamicAnimator* _animator;
UIGravityBehavior* _gravity;
UICollisionBehavior* _collision;

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    _animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view];
    _gravity = [[UIGravityBehavior alloc] initWithItems:@[_wrapperWolfBox]];
    [_animator addBehavior:_gravity];

    _collision = [[UICollisionBehavior alloc]
                  initWithItems:@[_wrapperWolfBox]];
    _collision.translatesReferenceBoundsIntoBoundary = YES;
    [_animator addBehavior:_collision];
//
// 

    CGAffineTransform maybeGetTransform = CGAffineTransformScale(_wrapperWolfBox.transform, 2.2, 2.2);
    _wrapperWolfBox.transform = maybeGetTransform;


    [_animator updateItemUsingCurrentState:self.wrapperWolfBox];




//    _animator.updateItemUsingCurrentState:self.catFishBox;


}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-11-28 09:40:00

我在这里回答我自己的问题,因为互联网似乎没有问,所以我错过了一些医生。

你不能用仿射,他们只是对动画师不友好。因此,我发现您从动态中移除视图,并更改“界限”或“框架”,然后将视图添加到动画中。

代码语言:javascript
复制
[_gravity removeItem:_wrapperWolfBox];
  CGRect frameZr = _wrapperWolfBox.bounds;
    frameZr.size.height += 60.0f;
    frameZr.size.width += 60.0f;
    _wrapperWolfBox.bounds = frameZr;
[_gravity addItem:_wrapperWolfBox];

这让我想到了我下一个有趣的问题和发现。规模是即时的。你可能想要,但我不想。所以我会在新的岗位上问这个问题。

享受吧!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19869111

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档