简体   繁体   English

Xamarin.Forms.Maps iOS填充

[英]Xamarin.Forms.Maps iOS Padding

I am having trouble finding a solution for my problem. 我在寻找解决方案时遇到了麻烦。 I am looking to set the padding for the Xamarin Forms Map (Mapkit/MKMapView) on iOS (Custom Renderer). 我想在iOS(自定义渲染器)上设置Xamarin表单地图(Mapkit / MKMapView)的填充。

For Android it can be set in the custom renderer with NativeMap.SetPadding(10,200,10,10) but I cannot find a way to do it in iOS. 对于Android,可以使用NativeMap.SetPadding(10,200,10,10)在自定义渲染器中进行设置,但是我找不到在iOS中实现此功能的方法。

The problem I am trying to solve is that the compass on the map appears on the top right corner of the map (iOS) and since I do have my own controls on the top of the map, the compass is not accessible. 我要解决的问题是地图上的指南针出现在地图(iOS)的右上角,并且由于我确实在地图顶部具有自己的控件,因此无法使用指南针。

On android setting the padding pushes the compass down below my controls and solves the issue. 在android上,填充设置将指南针向下推到我的控件下方,从而解决了该问题。

I'd appreciate any suggestion on how to solve it for iOS 我很感谢关于如何解决iOS的任何建议

MapKit.MKMapView MapKit.MKMapView

You can create your own MKCompassButton and alter its X/Y position (via its Frame) on the map. 您可以创建自己的MKCompassButton并更改其X / Y位置(通过其框架)在地图上。

var compass = MKCompassButton.FromMapView(mkMapViewInstance);
compass.CompassVisibility = MKFeatureVisibility.Visible;
compass.Frame = new CGRect( new CGPoint(25,25), compass.Frame.Size);

re: https://developer.apple.com/documentation/mapkit/mkcompassbutton?language=objc 回复: https//developer.apple.com/documentation/mapkit/mkcompassbutton?language = objc

Google.Maps.MapView (iOS) Google.Maps.MapView(iOS)

You can add padding around the edges of the map using the GMSMapView.padding property. 您可以使用GMSMapView.padding属性在地图边缘周围添加填充。 The map will continue to fill the entire container, but text and control positioning, map gestures, and camera movements will behave as if it has been placed in a smaller space. 地图将继续填充整个容器,但是文本和控件的位置,地图手势以及相机的移动将表现得好像放置在较小的空间中。 This results in the following changes: 这导致以下更改:

myGMSMapViewInstace.Padding = new UIEdgeInsets(100.0f, 100.0f, 100.0f, 100.0f);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用 Xamarin.Forms.Maps 在 iOS 上使用 Google 地图? - How to use Google Maps on iOS using Xamarin.Forms.Maps? 使用 Xamarin.Forms.Maps 上 Xamarin.Forms21920411ZCBD85089 - Weird problem getting device's location with Xamarin.Essentials Geolocation in Xamarin.Forms.Maps on iOS 如何在 xamarin.forms.maps (iOS) 中的标签上设置背景颜色和更改字体颜色? - How to set background color and change font color on Label in xamarin.forms.maps (iOS)? 有没有办法为 Xamarin.Forms.Maps 图钉运动设置动画 - Is there a way to animate Xamarin.Forms.Maps pin movement Xamarin.Forms.Maps 我如何像出租车一样旋转销钉 - Xamarin.Forms.Maps How i can rotation pins like a taxi 使用 Xamarin.Forms.Maps Visual Studio 上的 C# 代码中的变量更改 .xaml 文件中的静态地图坐标 - Changing static map coordinates from .xaml file with variables in C# code on Xamarin.Forms.Maps Visual Studio Xamarin Forms Maps-在iOS上显示当前位置 - Xamarin Forms Maps - showing current location on iOS 带填充和圆角的图标-适用于Xamarin Forms的iOS自定义渲染器 - Icon with padding and rounded corners - iOS Custom Renderer for Xamarin Forms UILabel在Xamarin.iOS中有填充? - UILabel with padding in Xamarin.iOS? Xamarin在iOS上的Forms Picker - Xamarin Forms Picker on IOS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM