Continuation of the article
In the iOS7, a lot of new features are actually added. I've seen it before and I've learned some new things. such as the new dynamic characteristics, Textkit graphics and text mixed, as well as their own definition of animation jump and so on. That time is also more busy, no time to tidy up. Now that the project is finished, I intend to learn about the new content at the same time in learning the old things.
First of all, the Uidynamicanimator class, all the simulation behavior of the parent class, this gives me the feeling of the same as the first to ask the text. or feel like adding a gesture or adding a view, detailing down.
Uidynamicbehavior: Simulation Behavior, is the parent of dynamic behavior, the main dynamic behavior class Uigravitybehavior, Uicollisionbehavior, Uiattachmentbehavior, Uisnapbehavior, Uipushbehavior, and Uidynamicitembehavior are inherited from the parent class if you want to know the following: http://www.cocoachina.com/newbie/basic/2013 /0616/6415.html
Gravity characteristics
Here we mainly first talk about the gravity characteristics, first casually said, before someone said three apples changed the world, one to jobs. One gave Turing, and one to Newton.
In junior high school, we were generally exposed to Newton's gravitational acceleration, which is free fall. (did not learn to own Baidu, added), with the help of this class of Uidynamicanimator, can help us to achieve a View object (UIView) can be as high as the falling apples, speed up the move. Create a uidynamicanimator Object First, and then add the created object to the Uidynamicanimator object. Add a property of the gravitational acceleration. It feels the same as joining a gesture.
. h
#import <UIKit/UIKit.h> @interface viewcontroller:uiviewcontroller{ uidynamicanimator * _animator; Uigravitybehavior * _gravity;} @end
. m
-(void) viewdidload{ [Super Viewdidload]; UIView * Apple = [[UIView alloc] Initwithframe:cgrectmake (40,40, +, +)]; Apple.backgroundcolor = [Uicolor redcolor]; [Self.view addsubview:apple]; _animator = [[Uidynamicanimator alloc] initWithReferenceView:self.view]; _gravity = [[Uigravitybehavior alloc] initwithitems:@[apple]; [_animator addbehavior:_gravity];}
Take a look. Look at the effect.
Click to follow me, a lot of other wonderful content!!
Group number: 336146073
IOS7 Uikit Dynamics-gravity characteristics Uigravitybehavior