Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
 public void StopLoading()
 {
     _lottieAnimation?.Pause();
     _lottieAnimation?.RemoveFromSuperview();
     _lottieAnimation?.Dispose();
     _lottieAnimation = null;
 }
Beispiel #3
0
        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);
            }
        }