@property (nonatomic, strong) uidynamicitembehavior *square1propertiesbehavior;
@property (nonatomic, strong) uidynamicitembehavior *square2propertiesbehavior;
@property (nonatomic, strong) uidynamicanimator *animator;
@property(nonatomic,strong)uidynamicanimator*dy;
@end
@implementation Viewcontroller
-(void) viewdidload {
[Super viewdidload];
UIView * Apple = [[UIView alloc] initwithframe:cgrectmake( (+/- )];
Apple. backgroundcolor = [uicolor redcolor];
[self. View addsubview: Apple];
uidynamicanimator *animator = [[uidynamicanimator alloc] Initwithreferenceview :self. View];
uigravitybehavior *gravitybeahvior = [[uigravitybehavior alloc] initwithitems:@ [Apple]];
uicollisionbehavior *collisionbehavior = [[uicollisionbehavior alloc] Initwithitems:@[Apple]];
uidynamicitembehavior*behavior = [[uidynamicitembehavior alloc] initwithitems: @[Apple]];
//behavior.elasticity =;
Collisionbehavior. translatesreferenceboundsintoboundary = YES;
[Animator Addbehavior: Gravitybeahvior];
[Animator Addbehavior: Collisionbehavior];
[Animator Addbehavior: behavior];
self. Dy = animator;//attribute hold to animate
}
-(void) didreceivememorywarning {
[Super didreceivememorywarning];
//Dispose of any resources, can be recreated.
}
iOS power effects, the most important point of the attribute retention (the reason for writing a power effect but no effect is here)