Edytuj

Udostępnij za pośrednictwem


UIViewController.BeginAppearanceTransition(Boolean, Boolean) Method

Definition

With EndAppearanceTransition(), tells child UIViewControllers that their UIViews are about to either appear or disappear.

[Foundation.Export("beginAppearanceTransition:animated:")]
public virtual void BeginAppearanceTransition (bool isAppearing, bool animated);
abstract member BeginAppearanceTransition : bool * bool -> unit
override this.BeginAppearanceTransition : bool * bool -> unit

Parameters

isAppearing
Boolean

true if the child UIViewController’s views are being shown, false if they are being hidden.

animated
Boolean

true if the transition is being animated.

Attributes

Remarks

This method, along with EndAppearanceTransition(), should be used to alert child UIViewControllers that their view or views are about to be shown or hidden. The application developer must invoke these methods and must not call ViewWillAppear(Boolean), ViewDidAppear(Boolean), ViewWillDisappear(Boolean), or ViewDidDisappear(Boolean) directly.

The following code, from the "Media Notes" sample, demonstrates the use of BeginAppearanceTransition(Boolean, Boolean) and EndAppearanceTransition(). The code snippet shows the child UIViewController being removed from the display (isAppearing is false) in an animated mirror (animated is true). The call to BeginAppearanceTransition(Boolean, Boolean) occurs and then EndAppearanceTransition() is called at the end of the specified animation.

commentViewIsVisible = false;
commentViewController.WillMoveToParentViewController (null);
commentViewController.BeginAppearanceTransition (false, true);
UIView.Animate (0.5f, () => {
    commentView.Alpha = 0.5f;
}, () => { 
    commentView.RemoveFromSuperview ();
    commentViewController.EndAppearanceTransition ();
    commentViewController.RemoveFromParentViewController ();
});

Applies to

See also