Esempio n. 1
0
        public static CALayer StoreCellLayer(RectangleF frame)
        {
            CALayer layer = new CALayer();
            layer.Frame = frame;

            CALayer backgroundLayer = new CALayer();
            backgroundLayer.Frame = new RectangleF(0, 0, frame.Width, frame.Height);
            backgroundLayer.BackgroundColor = UIColor.FromRGBA(19, 19, 19, 255).CGColor;
            layer.InsertSublayer(backgroundLayer, 0);

            CALayer topLayer1 = new CALayer();
            topLayer1.Frame = new RectangleF(0, 0, frame.Width, 1);
            topLayer1.BackgroundColor = UIColor.FromRGBA(25, 27, 28, 255).CGColor;
            layer.InsertSublayerAbove(topLayer1, backgroundLayer);

            CALayer topLayer2 = new CALayer();
            topLayer2.Frame = new RectangleF(0, 1, frame.Width, 1);
            topLayer2.BackgroundColor = UIColor.FromRGBA(10, 10, 10, 255).CGColor;
            layer.InsertSublayerAbove(topLayer2, backgroundLayer);

            CALayer bottomLayer1 = new CALayer();
            bottomLayer1.Frame = new RectangleF(0, frame.Height - 2, frame.Width, 1);
            bottomLayer1.BackgroundColor = UIColor.FromRGBA(23, 25, 26, 255).CGColor;
            layer.InsertSublayerAbove(bottomLayer1, backgroundLayer);

            CALayer bottomLayer2 = new CALayer();
            bottomLayer2.Frame = new RectangleF(0, frame.Height - 1, frame.Width, 1);
            bottomLayer2.BackgroundColor = UIColor.FromRGBA(42, 43, 44, 255).CGColor;
            layer.InsertSublayerAbove(bottomLayer2, backgroundLayer);

            return layer;
        }
Esempio n. 2
0
        public static CALayer SinkContourLayer(RectangleF frame, float radius)
        {
            CALayer layer = new CALayer();
            layer.Frame = frame;
            layer.CornerRadius = radius;

            CALayer topLayer = new CALayer();
            topLayer.Frame = new RectangleF(0, -1f, frame.Width, frame.Height);
            topLayer.CornerRadius = radius;
            topLayer.BackgroundColor = UIColor.FromRGBA(150, 150, 150, 255).CGColor;
            layer.InsertSublayerAbove(topLayer, layer);

            CALayer bottomLayer = new CALayer();
            bottomLayer.Frame = new RectangleF(0, 1f, frame.Width, frame.Height);
            bottomLayer.CornerRadius = radius;
            bottomLayer.BackgroundColor = UIColor.FromRGBA(40, 40, 40, 255).CGColor;
            layer.InsertSublayerAbove(bottomLayer, layer);

            CAGradientLayer leftLayer = new CAGradientLayer();
            leftLayer.Frame = new RectangleF(-1f, 0, frame.Width, frame.Height);
            leftLayer.CornerRadius = radius;
            leftLayer.Colors =  new MonoTouch.CoreGraphics.CGColor[]
            {
                UIColor.FromRGBA(100, 100, 100, 255).CGColor,
                UIColor.FromRGBA(40, 40, 40, 255).CGColor
            };
            layer.InsertSublayerAbove(leftLayer, layer);

            CAGradientLayer rightLayer = new CAGradientLayer();
            rightLayer.Frame = new RectangleF(1f, 0, frame.Width, frame.Height);
            rightLayer.CornerRadius = radius;
            rightLayer.Colors =  new MonoTouch.CoreGraphics.CGColor[]
            {
                UIColor.FromRGBA(100, 100, 100, 255).CGColor,
                UIColor.FromRGBA(40, 40, 40, 255).CGColor
            };
            layer.InsertSublayerAbove(rightLayer, layer);

            return layer;
        }