0
Einfach eines Tages, beeindrucken Sie Ihre Freunde!HybridWebView .LoadContent lädt LoadContent nicht auf iOS
Hybridwebview von xlabs - https://github.com/XLabs/Xamarin-Forms-Labs/wiki/HybridWebView
Versuch Inhalt zu laden, wie unten gezeigt.
Funktioniert gut auf Android, zeigt nichts auf ios mit str oder str2.
Irgendwelche Ideen?
CSHARP
void OnButtonStaticLoadClicked(object sender, EventArgs args)
{
// doesnt load on ios
string str = @"<html><body><h2>hello there</h2><div>four score and seven years ago </div></body></html>";
string str2 = @"<!DOCTYPE html>" +
@"<html>" +
@"<body bgcolor='yellow'><h2>hello there</h2><div style='font-color:black'>four score and seven years ago</div>" +
@"</body></html>";
HybridWebView_Main.LoadContent(str2);
}
XAML
<StackLayout>
<Button x:Name="Button_LoadStatic" Text="Load Static HTML" Clicked="OnButtonStaticLoadClicked" />
<controls:HybridWebView x:Name="HybridWebView_Main"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"
BackgroundColor="Yellow"
HeightRequest="300" />
</StackLayout>
Hinweis: habe ich es etwas außerhalb des Namespace in meinem AppDelegate.cs in meinem HybridWebViewPlay.iOS Projekt ... [assembly: ExportRenderer (typeof (HybridWebView), typeof (HybridWebViewRenderer))] Namespace HybridWebViewXLabs.iOS { // Das UIApplicationDelegate für die Anwendung. Diese Klasse ist verantwortlich für das Starten der ... –
Ja, Assembly-Attribute müssen vor jeder anderen Deklaration in einer Datei platziert werden :) –
Ich hatte dieses Problem beim Kompilieren einer UWP-App mit der .Net-Native-Tool-Kette. Ohne die .Net-Native-Werkzeugkette war alles in Ordnung; aber sobald ich es aktiviert habe, zeigte die App nur eine leere Seite. Das Hinzufügen der Renderer-Baugruppe hat das Problem gelöst! Vielen Dank! – Dominic