其实只要判断当前的navigationController的viewControllers的数量就可以知道是不是根视图了. self. navigationController.viewControllers.count == 1