I am simply trying to understand the way to use updateItemUsingCurrentState
and how to send a scaled UIView or UIImageView to the animator so I can
have a large box and small box for physics tests on viewDidLoad. I want to
learn how to pass it this info so I can dynamically change the size later
in other events.

I saw a post about updateItemUsingCurrentState from a stackoverflow
question and within Apples docs for it, but I can't find a hard example
using scale with it. The docs at Apple say it updates the rotation.

Im sure ill find out that I need to change the bounds or something else
later, but for now I just wanna get past this barrier.

Sample code below:

@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;




}
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to