tal-tech / d_stack

A Flutter hybrid stack solution
MIT License
106 stars 37 forks source link

移除混合栈中节点 #17

Open lijiee opened 3 years ago

lijiee commented 3 years ago

如何在原生端移除当前节点列表中的flutter节点

   func goLogin() {
    let nodeList = DNodeManager.sharedInstance().currentNodeList

    let currentNode = DNodeManager.sharedInstance().currentNode

    let vc = THDFlutterViewController.init()
    let nav = THNavController.init(rootViewController: vc)
    vc.navigationController?.isNavigationBarHidden = true
    self.window?.rootViewController = nav
}

func goHome(){

    let nodeList = DNodeManager.sharedInstance().currentNodeList
    let currentNode = DNodeManager.sharedInstance().currentNode

    if THUserInfoManager.userType() == .AppTypeAudit{
        let nav = THNavController.init(rootViewController: THAuditHomeController.init())
        self.window?.rootViewController = nav
        return
    }
    var vc:UITabBarController?
    if THUserInfoManager.userType() == .AppTypeResident {
        vc = THBenefitTabBarController.init()
    }else if THUserInfoManager.userType() == .AppTypeAssess {
        vc = THAssessTabBarController.init()
    }else{
        vc = THNurseTabBarController.init()
    }
    self.window?.rootViewController = vc
}
whqfor commented 3 years ago

回到首页直接调用popToRoot 这个api就可以啦,之后想切换rootVC的话再调用self.window?.rootViewController = vc

whqfor commented 3 years ago

你们是Swift项目吗? 使用dstack有啥问题不,框架没有对Swift做特殊处理。

whqfor commented 2 years ago

理论上是可以的,清节点操作未开放