public static void CustomButtomLoadingAnimation(string animation, UIButton button, string viewText, bool shouldAnimate) { if (shouldAnimate) { _lottieAnimation = LOTAnimationView.AnimationNamed(animation); _lottieAnimation.ContentMode = UIViewContentMode.ScaleAspectFit; _lottieAnimation.Frame = button.Frame; button.AddSubview(_lottieAnimation); _lottieAnimation.LoopAnimation = true; button.SetTitle("", UIControlState.Normal); _lottieAnimation.AnimationProgress = 0; _lottieAnimation.Hidden = false; _lottieAnimation.Play(); } else { if (_lottieAnimation != null) { _lottieAnimation.Hidden = true; _lottieAnimation.Pause(); _lottieAnimation?.Dispose(); _lottieAnimation = null; } button.SetTitle(viewText, UIControlState.Normal); } }
public void StopLoading() { _lottieAnimation?.Pause(); _lottieAnimation?.RemoveFromSuperview(); _lottieAnimation?.Dispose(); _lottieAnimation = null; }
public override void ViewDidDisappear(bool animated) { base.ViewDidDisappear(animated); if (this.IsMovingFromParentViewController) { _lottieAnimation?.Dispose(); _lottieAnimation = null; _viewWillShow?.Dispose(); _viewWillShow = null; _tableViewTapGesture = null; MemoryUtility.ReleaseUIViewWithChildren(this.View); } }