ChildViewController/View 没有获得 GMSMapView 的焦点

ChildViewController/View does not get focus with GMSMapView

上下文:我想实现与 based on https://github.com/grendio/XBottomSheet/tree/master/XBottomSheet.Samples/XBottomSheet.Touch类似的东西

问题:如果我将 BottomSheet 与 Google Maps for iOS View 一起使用,它不允许我向上或向下拖动 BottomSheet,即使如果它添加(它在屏幕上可见)。

代码:如前所述,我有一个 Google 地图视图和我的 BottomSheet 视图:

    public override void ViewDidLoad()
    {
        base.ViewDidLoad();

        SetMap();
        SetBottomSheet();
    }

    private void SetMap()
    {
        var frame = new CGRect(0, View.Frame.GetMaxY(), View.Frame.Width, View.Frame.Height);
        mapView = new MapView(View.Frame);
        mapView.MyLocationEnabled = true;

        mapView.BuildingsEnabled = false;
        mapView.SetMinMaxZoom(15f, 18f);

        View = mapView;
    }

    private void SetBottomSheet()
    {
        var bottom = UIScreen.MainScreen.Bounds.Height - UIApplication.SharedApplication.StatusBarFrame.Height;
        bottomSheetViewController = new BottomSheetViewController(100, 300, bottom, true, BottomSheetState.Middle);

        AddChildViewController(bottomSheetViewController);
        View.AddSubview(bottomSheetViewController.View);
        bottomSheetViewController.DidMoveToParentViewController(this);

        bottomSheetViewController.View.Frame = new CGRect(0, View.Frame.GetMaxY(), View.Frame.Width, View.Frame.Height);
    }

如何连接这两个视图(mapView 和 bottomSheetViewController.View)才能不丢失 BottomSheet 控件的拖动 up/down 功能?

即使问题是针对 Xamarin 的,swift 或 objective-c 的回答也可以,因为我之后会做 'translation'。

我有一个类似的项目,当时我的解决方案是将 ConsumeGesturesInView 属性 设置为 false

所以您的 SetMap() 方法应该如下所示:

private void SetMap()
{
    var frame = new CGRect(0, View.Frame.GetMaxY(), View.Frame.Width, View.Frame.Height);
    mapView = new MapView(View.Frame);
    mapView.MyLocationEnabled = true;
    mapView.Settings.ConsumeGesturesInView = false;
    mapView.BuildingsEnabled = false;
    mapView.SetMinMaxZoom(15f, 18f);

    View = mapView;
}