UISnapBehavior常见属性
复制代码@property (nonatomic, assign) CGFloat damping;
用于减幅、减震(取值范围是0.0 ~ 1.0,值越大,震动幅度越小)
UISnapBehavior使用注意
如果要进行连续的捕捉行为,需要先把前面的捕捉行为从物理仿真器中移除
二、代码说明
在storyboard中放一个view控件,作为演示用的仿真元素。
代码如下:
复制代码//
// YYViewController.m
// 13-捕捉行为
//
// Created by apple on 14-8-8.
// Copyright (c) 2014年 yangyong. All rights reserved.
//
#import "YYViewController.h"
@interface YYViewController ()
@property (weak, nonatomic) IBOutlet UIView *blueView;
@property(nonatomic,strong)UIDynamicAnimator *animator;
@end
@implementation YYViewController
-(UIDynamicAnimator *)animator
{
if (_animator==nil) {
//创建物理仿真器,设置仿真范围,ReferenceView为参照视图
_animator=[[UIDynamicAnimator alloc]initWithReferenceView:self.view];











