obi*_*ter 2 xcode objective-c uitableview uinavigationcontroller ios
我有一个UINnavigationController处理导航的UITableView.
当我从表格中选择一行时,我需要在UINavigationController标题中显示上一个菜单中的所选项目.
从xml填充行的外部读取单元格的标签UITableView.
如何在标题上显示我的选择UINavigationBar?
我使用self.title命令设置了静态标题,但它不符合我的需要
这对您有用吗?
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
{
DetailTableViewController *detailController = [[DetailTableViewController alloc] initWithStyle:UITableViewStyleGrouped];
// Set the detail controller title to whatever you want here...
detailController.title = @"Your title";
// Or set it to the title of this row
UITableViewCell *cell = [[self tableView] cellForRowAtIndexPath:indexPath];
detailController.title = cell.textLabel.text;
[[self navigationController] pushViewController:detailController animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
Normaly的UINavigationController总是挑选出title了的UIViewController已实际加载.这就是为什么你必须在里面定义它viewDidLoad:
self.title = @"Title";
Run Code Online (Sandbox Code Playgroud)
上面显示的方法似乎更具动态......但这也有效.
| 归档时间: |
|
| 查看次数: |
6831 次 |
| 最近记录: |