Iphone ParentViewController返回nil

Iphone ParentViewController返回nil,iphone,Iphone,我知道在这方面有很多问题,但我无法让它发挥作用 我用presentModalViewController演示了一个UITabBarController。但是,当我尝试从呈现tabcontroller的UINavigationController类中的navigationItem title属性获取标题时,无论我做什么,它都返回nil。我在tabcontroller类的viewDidLoad方法中有NSLog 我还强制转换由self.parentViewController属性返回的UIViewC

我知道在这方面有很多问题,但我无法让它发挥作用

我用presentModalViewController演示了一个UITabBarController。但是,当我尝试从呈现tabcontroller的UINavigationController类中的navigationItem title属性获取标题时,无论我做什么,它都返回nil。我在tabcontroller类的viewDidLoad方法中有NSLog

我还强制转换由self.parentViewController属性返回的UIViewController。 然后我尝试通过以下方式访问标题:NSLog@%@,castedViewController.navigationItem.title


有什么建议吗?

你说的是两件不同的事。第一个是UITabBarController,底部有两个或多个按钮。第二件事是一个UINavigationController,它位于每个视图的顶部,显示一个标题和一个后退按钮。 如果以模式显示选项卡栏,则不会得到“后退”按钮,而是应按下它。像navigationController pushView这样的东西目前无法准确命名

无论如何,请尝试不调用navigationItem.title,而是调用navigationBar.topItem.title