在 AppDelegate.swift
的方法里設(shè)置
let tabBarController = window!.rootViewController as! UITabBarController
let nav = tabBarController.viewControllers!.first as! UINavigationController
let viewController = nav.viewControllers.first as! UIViewController
viewController.doSomething()