【发布时间】:2017-03-04 17:35:07
【问题描述】:
我想更改导航控制器的文本和字体。
我有一个静态的UITableView,当用户单击一个单元格时 - 我通过 segue 转到第二个 UIViewController。
我在故事板和我拥有的代码中设置了转场的名称:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if (segue.identifier == "myTestSegue") {
if segue.destination is MyTest {
print("can I see it?")
let backButton = UIBarButtonItem(title: "Back", style: UIBarButtonItemStyle.plain, target: self, action: nil)
backButton.setTitleTextAttributes([NSFontAttributeName: UIFont(name: "AppleSDGothicNeo-Light", size: 20.0)!], for: UIControlState())
navigationItem.backBarButtonItem = backButton
}
}
}
现在,当我运行应用程序并单击单元格时,我在控制台中看到:can I see it?,但下一个面板上按钮的文本和字体没有改变。
我错过了什么?
【问题讨论】:
-
我用相同的代码设置了完全相同的情况,它对我有用。所以你在上面解释的事情之外发生了一些事情。
标签: ios swift uinavigationcontroller uinavigationbar uistoryboardsegue