Düzenle

Aracılığıyla paylaş


UIDynamicAnimator.AddBehaviors(UIDynamicBehavior[]) Method

Definition

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);
}

Applies to