void ReleaseDesignerOutlets() { if (ShadowView != null) { ShadowView.Dispose(); ShadowView = null; } if (CoverImageView != null) { CoverImageView.Dispose(); CoverImageView = null; } if (TitleLabel != null) { TitleLabel.Dispose(); TitleLabel = null; } if (DescriptionLabel != null) { DescriptionLabel.Dispose(); DescriptionLabel = null; } }
public virtual void SetupLayer() { float cornerRadius = Element.CornerRadius; if (cornerRadius == -1f) { cornerRadius = 5f; // default corner radius } Layer.CornerRadius = cornerRadius; Layer.MasksToBounds = Layer.CornerRadius > 0; if (Element.BackgroundColor == Color.Default) { Layer.BackgroundColor = ColorExtensions.BackgroundColor.CGColor; } else { Layer.BackgroundColor = Element.BackgroundColor.ToCGColor(); } if (Element.BorderColor == Color.Default) { Layer.BorderColor = UIColor.Clear.CGColor; } else { Layer.BorderColor = Element.BorderColor.ToCGColor(); Layer.BorderWidth = 1; } if (Element.HasShadow) { if (_shadowView == null) { _shadowView = new ShadowView(Layer); SetNeedsLayout(); } _shadowView.UpdateBackgroundColor(); _shadowView.Layer.CornerRadius = Layer.CornerRadius; _shadowView.Layer.BorderColor = Layer.BorderColor; _shadowView.Hidden = !Element.IsVisible; } else { if (_shadowView != null) { _shadowView.RemoveFromSuperview(); _shadowView.Dispose(); _shadowView = null; } } Layer.RasterizationScale = UIScreen.MainScreen.Scale; Layer.ShouldRasterize = true; }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { if (_shadowView != null) { _shadowView.RemoveFromSuperview(); _shadowView.Dispose(); _shadowView = null; } } }
private void InitShadow() { _shadowView = FindObjectOfType <ShadowView>(); _shadowManager = new ShadowManager(); _shadowManager.action = _shadowView.OnReceiveShadowData; }