Exemplo n.º 1
0
        public void Close()
        {
            var ea = new CustomIOSAlertViewClosingEventArgs();

            Closing?.Invoke(this, ea);
            if (ea.Cancel)
            {
                return;
            }
            CATransform3D currentTransform = DialogView.Layer.Transform;

            if (NSFoundationVersionNumber <= NSFoundationVersionNumber_iOS_7_1)
            {
                float         startRotation = ((NSNumber)DialogView.ValueForKeyPath(new NSString("layer.transform.rotation.z"))).FloatValue;
                CATransform3D rotation      = CATransform3D.MakeRotation(new nfloat(-startRotation + Math.PI * 270.0 / 180.0), 0.0f, 0.0f, 0.0f);

                DialogView.Layer.Transform = rotation.Concat(CATransform3D.MakeScale(1, 1, 1));
            }

            DialogView.Layer.Opacity = 1.0f;

            UIView.Animate(0.2f, 0.0, UIViewAnimationOptions.TransitionNone, () =>
            {
                BackgroundColor            = UIColor.FromRGBA(0.0f, 0.0f, 0.0f, 0.0f);
                DialogView.Layer.Transform = currentTransform.Concat(CATransform3D.MakeScale(0.6f, 0.6f, 1.0f));
                DialogView.Layer.Opacity   = 0;
            }, () =>
            {
                foreach (var v in Subviews)
                {
                    v.RemoveFromSuperview();
                }
                RemoveFromSuperview();

                Closed?.Invoke(this, EventArgs.Empty);
            });
        }