iOS power effects, the most important point of the attribute retention (the reason for writing a power effect but no effect is here)

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.