代码之家  ›  专栏  ›  技术社区  ›  Max Kortge

更改抽屉视图控制器滑轮

  •  0
  • Max Kortge  · 技术社区  · 7 年前

    我目前正在使用 Pulley 在我的地图中创建一个类似抽屉的东西。我现在要做的是,当选择注释时,它会将抽屉更改为另一个抽屉。我遵循了开发人员说要在GitHub上使用的代码,但它从来都不起作用。

    这是我的代码:

    func mapView(_ didSelectmapView: MKMapView, didSelect view: MKAnnotationView) {
        print("Annotation selected")
    
        if let drawer = self.parent as? PulleyViewController {
            let drawerContent = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "NewDrawerViewController")
    
            drawer.setDrawerContentViewController(controller: drawerContent, animated: false)
            drawer.setDrawerPosition(position: PulleyPosition.partiallyRevealed, animated: false)
    
        }
    }
    

    1 回复  |  直到 7 年前
        1
  •  1
  •   Max Kortge    7 年前

    在调试视图控制器的父对象之后,我发现它不起作用,因为视图控制器的父对象是一个 UINavigationViewController if let drawer = self.parent as? PulleyViewController {