如何获取文本在backBarButtonItem? [英] How to get the text in a backBarButtonItem?

查看:95
本文介绍了如何获取文本在backBarButtonItem?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道如何在使用UINavigationController时获取backBarButtonItem的文本内容?这是上一个视图的名称,但我想在下一个视图中获得它。





谢谢!

解决方案>

这里有一种方法可以在导航控制器viewController堆栈中获得上一个viewController的标题:

 ((UIViewController * )[self.navigationController.viewControllers objectAtIndex:self.navigationController.viewControllers.count-2])。title 


does anyone knows how to get the text content of a backBarButtonItem when using a UINavigationController ? It's the name of the previous view but I'd like to get it in the next view.

Thanks!

解决方案

Here's one way to get the title of the previous viewController in the navigation controller viewController stack:

((UIViewController*)[self.navigationController.viewControllers objectAtIndex:self.navigationController.viewControllers.count-2]).title

这篇关于如何获取文本在backBarButtonItem?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆