Beispiel #1
0
        protected override void OnElementChanged(VisualElementChangedEventArgs e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null || Element == null)
            {
                return;
            }

            try
            {
                //var el = (ContentPage)Element;
                var img = UIImage.FromBundle("bg_shadow.png");
                BGImage             = new UIImageView(img);
                BGImage.ContentMode = UIViewContentMode.ScaleAspectFill;
                NativeView.InsertSubview(BGImage, 0);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(@"            ERROR: ", ex.Message);
            }
        }
Beispiel #2
0
        void RippleEffect(NSSet touches)
        {
            var touch  = touches.AnyObject as UITouch;
            var center = touch.LocationInView(NativeView);

            var dimension = Element.Height > Element.Width
                ? (float)Element.Height
                : (float)Element.Width;

            ripple          = ripple ?? new UIView(new CGRect(0, 0, dimension, dimension));
            rippleContainer = rippleContainer ?? new UIView(new CGRect(0, 0, Element.Width, Element.Height));

            ripple.Alpha = .5f;
            ripple.Layer.CornerRadius = dimension * .5f;
            ripple.BackgroundColor    = FrameRipple.RippleColor.ToUIColor();
            ripple.Center             = center;
            ripple.Transform          = CGAffineTransform.MakeScale(0, 0);

            rippleContainer.ClipsToBounds = true;
            rippleContainer.InsertSubview(ripple, 0);

            NativeView.InsertSubview(rippleContainer, 1);

            var scale = 4.0f;

            Animate(.6f,
                    () =>
            {
                ripple.Transform = CGAffineTransform.MakeScale(scale, scale);
                ripple.Alpha     = 0;
            },
                    () =>
            {
                rippleContainer.RemoveFromSuperview();
                ripple.RemoveFromSuperview();
            });
        }