标签:
1.继承链:NSObject
2.可以遵守UIDynamicItem协议
3.为了能够使用动态行为,你需要使用这些类创建的对象: UIAttachmentBehavior
, UICollisionBehavior
, UIDynamicItemBehavior
, UIGravityBehavior
, UIPushBehavior
, and UISnapBehavior
.
4.初始化和管理动态动画
(1)- (instancetype)initWithReferenceView:(UIView *)view
:为一个视图初始化动态对象
(2)- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout
:使用一个指定的collection视图布局来初始化动态动画对象
(3)- (NSArray<id<UIDynamicItem>> *)itemsInRect:(CGRect)rect
:返回一个指定矩形内的动态动画item
(4)- (void)addBehavior:(UIDynamicBehavior *)behavior
:为动态动画添加行为、如重力、碰撞
(5)- (void)removeBehavior:(UIDynamicBehavior *)behavior
:为动态动画删除指定的行为
(6)- (void)removeAllBehaviors :为动态动画删除所有的行为
5.读取动态动画的状态
(1)- (NSTimeInterval)elapsedTime :返回动态动画开始的时间
(2)@property(nonatomic, readonly, getter=isRunning) BOOL running :是否让该动态动画运行
(3)@property(nonatomic, readonly, copy) NSArray <__kindof UIDynamicBehavior *> *behaviors :返回该动态动画所有的行为
(4)@property(nonatomic, readonly) UIView *referenceView :返回该动态动画参考的视图,就是初始化的时候用的是哪个视图
(5)@property(nonatomic, weak) id< UIDynamicAnimatorDelegate > delegate :设置动态动画的委托
(6)- (void)updateItemUsingCurrentState:(id<UIDynamicItem>)item
:读取当前的状态来进行更新动态动画
6.储藏添加视图
(1)- (UICollectionViewLayoutAttributes *)layoutAttributesForCellAtIndexPath:(NSIndexPath *)indexPath
:返回指定索引的单元布局属性
(2)- (UICollectionViewLayoutAttributes *)layoutAttributesForDecorationViewOfKind:(NSString*)decorationViewKind
atIndexPath:(NSIndexPath*)indexPath
:
(3)- (UICollectionViewLayoutAttributes *)layoutAttributesForSupplementaryViewOfKind:(NSString *)kind
atIndexPath:(NSIndexPath*)indexPath
:
标签:
原文地址:http://www.cnblogs.com/lelun/p/5723291.html