maui-linux/docs/Xamarin.Forms.Maps/ns-Xamarin.Forms.Maps.xml

60 строки
1.5 KiB
XML

<Namespace Name="Xamarin.Forms.Maps">
<Docs>
<summary>Cross-Platform Library for Displaying and Annotating Maps.</summary>
<remarks>
<para>Xamarin.Forms.Maps provides a cross-platform abstraction for displaying maps. To use Xamarin.Forms.Maps, application developers must calls Xamarin.FormsMaps.Init() as part of platform initialization, as shown in the following example:</para>
<example>
<code lang="C#"><![CDATA[
//Shared
public class App
{
public static Page GetMainPage ()
{
return new ContentPage {
Content = new Map (MapSpan.FromCenterAndRadius (new Position (37, -122), Distance.FromMiles (10)))
};
}
}
//iOS
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
UIWindow window;
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
Forms.Init ();
FormsMaps.Init ();
window = new UIWindow (UIScreen.MainScreen.Bounds);
window.RootViewController = App.GetMainPage ().CreateViewController ();
window.MakeKeyAndVisible ();
return true;
}
}
//Android
namespace HelloMap.Android
{
[Activity (Label = "HelloMap.Android.Android", MainLauncher = true)]
public class MainActivity : AndroidActivity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
Xamarin.Forms.Forms.Init (this, bundle);
FormsMaps.Init(this, bundle);
SetPage (App.GetMainPage ());
}
}
}
]]></code>
</example>
</remarks>
</Docs>
</Namespace>