[英]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的任何建议
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
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.