You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iot/labs/XamarinApp/XamarinApp.iOS/WkWebViewRenderer.cs

22 lines
665 B

using Xamarin.Essentials;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using XamarinApp.iOS;
[assembly: ExportRenderer(typeof(WebView), typeof(CustomWebViewRenderer))]
namespace XamarinApp.iOS
{
public class CustomWebViewRenderer : WkWebViewRenderer
{
protected override void OnElementChanged(VisualElementChangedEventArgs e)
{
base.OnElementChanged(e);
if (e.NewElement != null)
{
CustomUserAgent = $"{DeviceInfo.Manufacturer} {DeviceInfo.Model} {Device.RuntimePlatform} {(Device.Idiom == TargetIdiom.Tablet ? "ipad" : "iphone")} Mac OS X";
}
}
}
}