这段代码是否应该在我连接的 ViewController 上设置标题?
2 个 UIViewControllers 通过推送连接连接 - 第一个嵌入在 NavigationController 中。
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"settingsSegue"])
{
self.navigationItem.title = [[NSString alloc] initWithFormat:@"Custom Title"];
}
}
它对我不起作用,但语法是正确的。
提前致谢:-)
最佳答案
除了一个异常(exception),以上答案对我有用......
改变
self.title = myTitle;
到
self.navigationItem.title = myTitle;
关于ios Storyboard - 将标题推送到 View Controller,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11007036/