uitableview + 导航控制器从所选元素设置标题 [英] uitableview + navigation controller set title from selected element

查看:16
本文介绍了uitableview + 导航控制器从所选元素设置标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 UINnavigationController 来处理 UITableView 中的导航.

I have a UINnavigationController that handles the navigation in a UITableView.

当我从表中选择一行时,我需要在 UINavigationController 标题中显示上一个菜单中的所选项目.

When I select a row from the table I need to display in the UINavigationController title the selected item from the previous menu.

单元格的标签是从填充 UITableView 的行的外部 xml 读取的.

The label of the cell is read from an external xml that fills the rows of the UITableView.

如何在 UINavigationBar 的标题上显示我的选择?

How can I display my selection on the title of the UINavigationBar?

我使用 self.title 命令设置了静态标题,但它不符合我的需要

I've set a static title by using the self.title command, but it doesn't fit my needs

推荐答案

通常 UINavigationController 总是选择 UIViewControllertitle已实际加载.这就是为什么你必须在 viewDidLoad 中定义它:

Normaly the UINavigationController always picks out the title of the UIViewController which has been actually loaded. Thats why you have to define it inside viewDidLoad:

self.title = @"Title";

上面显示的方法似乎更动态...但这也有效.

The method displayed above seems to be more dynamic...but this also works.

这篇关于uitableview + 导航控制器从所选元素设置标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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