ui adjustment
This commit is contained in:
53
Pixiview.iOS/Renderers/CardViewRenderer.cs
Normal file
53
Pixiview.iOS/Renderers/CardViewRenderer.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using CoreGraphics;
|
||||
using Pixiview.iOS.Renderers;
|
||||
using Pixiview.UI;
|
||||
using UIKit;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: ExportRenderer(typeof(CardView), typeof(CardViewRenderer))]
|
||||
namespace Pixiview.iOS.Renderers
|
||||
{
|
||||
public class CardViewRenderer : VisualElementRenderer<CardView>
|
||||
{
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<CardView> e)
|
||||
{
|
||||
base.OnElementChanged(e);
|
||||
|
||||
var layer = Layer;
|
||||
var element = e.NewElement;
|
||||
if (layer != null && element != null)
|
||||
{
|
||||
var cornerRadius = element.CornerRadius;
|
||||
if (cornerRadius > 0)
|
||||
{
|
||||
layer.CornerRadius = cornerRadius;
|
||||
}
|
||||
|
||||
//if (element.BackgroundColor != default)
|
||||
//{
|
||||
// layer.BackgroundColor = element.BackgroundColor.ToCGColor();
|
||||
//}
|
||||
|
||||
var shadowColor = element.ShadowColor;
|
||||
if (shadowColor != default)
|
||||
{
|
||||
layer.ShadowColor = shadowColor.ToCGColor();
|
||||
layer.ShadowOpacity = 1f;
|
||||
|
||||
var radius = element.ShadowRadius;
|
||||
if (radius > 0)
|
||||
{
|
||||
layer.ShadowRadius = radius;
|
||||
}
|
||||
|
||||
layer.ShadowOffset = element.ShadowOffset.ToSizeF();
|
||||
}
|
||||
else
|
||||
{
|
||||
layer.ShadowOpacity = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user