* Pixiview/UI/CircleUIs.cs:
* Pixiview.iOS/Pixiview.iOS.csproj: * Pixiview.iOS/Renderers/RoundLabelRenderer.cs: * Pixiview.iOS/Renderers/CircleImageRenderer.cs: custom round corner controls * Pixiview/App.xaml: * Pixiview/Utils/Converters.cs: * Pixiview/GlobalSuppressions.cs: * Pixiview/UI/StyleDefinition.cs: * Pixiview/UI/AdaptedPage.cs: * Pixiview.iOS/Renderers/AdaptedPageRenderer.cs: observe orientation * Pixiview/MainPage.xaml: * Pixiview/Utils/Stores.cs: * Pixiview/MainPage.xaml.cs: * Pixiview/Utils/IllustData.cs: data and UI adjust
This commit is contained in:
47
Pixiview.iOS/Renderers/RoundLabelRenderer.cs
Normal file
47
Pixiview.iOS/Renderers/RoundLabelRenderer.cs
Normal file
@ -0,0 +1,47 @@
|
||||
using System.ComponentModel;
|
||||
using Pixiview.iOS.Renderers;
|
||||
using Pixiview.UI;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.Platform.iOS;
|
||||
|
||||
[assembly: ExportRenderer(typeof(RoundLabel), typeof(RoundLabelRenderer))]
|
||||
namespace Pixiview.iOS.Renderers
|
||||
{
|
||||
public class RoundLabelRenderer : LabelRenderer
|
||||
{
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
|
||||
{
|
||||
base.OnElementChanged(e);
|
||||
|
||||
if (Control != null && Element is RoundLabel label)
|
||||
{
|
||||
int radius = label.CornerRadius;
|
||||
if (radius > 0)
|
||||
{
|
||||
Control.Layer.CornerRadius = radius;
|
||||
Control.BackgroundColor = label.BackgroundColor.ToUIColor();
|
||||
Control.Layer.MasksToBounds = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
base.OnElementPropertyChanged(sender, e);
|
||||
|
||||
if (e.PropertyName == RoundLabel.CornerRadiusProperty.PropertyName)
|
||||
{
|
||||
if (Control != null && Element is RoundLabel label)
|
||||
{
|
||||
int radius = label.CornerRadius;
|
||||
if (radius > 0)
|
||||
{
|
||||
Control.Layer.CornerRadius = radius;
|
||||
Control.BackgroundColor = label.BackgroundColor.ToUIColor();
|
||||
Control.Layer.MasksToBounds = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user