UIDynamicAnimator.AddBehaviors(UIDynamicBehavior[]) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds the array of specified behaviors.
public void AddBehaviors (params UIKit.UIDynamicBehavior[] behaviors);
member this.AddBehaviors : UIKit.UIDynamicBehavior[] -> unit
Parameters
- behaviors
- UIDynamicBehavior[]
Behaviors that you want to add to the animator
Remarks
The following example shows how you can add a couple of behaviors to an animator:
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
var gravityBehavior = new UIGravityBehavior (square);
var collisionBehavior = new UICollisionBehavior (square) {
TranslatesReferenceBoundsIntoBoundary = true
};
collisionBehavior.BeganBoundaryContact += BeganContact;
collisionBehavior.EndedBoundaryContact += EndedContact;
animator = new UIDynamicAnimator (View);
// Add the two behaviors at once
animator.AddBehaviors (gravityBehavior, collisionBehavior);
}