简体   繁体   English

如何从 SideMenu 更改 TabBarController 选择的项目?

[英]How can I change TabBarController selected Item from SideMenu?

import SideMenu
import UIKit

class SideMenuViewController: UITableViewController {

      //...

    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        self.tabBarController?.selectedIndex = indexPath.row
        self.dismiss(animated: true)
    }
}

have a look here...看看这里...

let appDelegate = UIApplication.shared.delegate as! AppDelegate

if let tabBarController = appDelegate.window!.rootViewController as? UITabBarController {
    tabBarController.selectedIndex = indexPath.row
}

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM