有没有办法为 UIViewController
的标题设置一个 accessibilityLabel
? View Controller 的 title
是一个字符串,我确定标题应该在某处有一个标签,我该如何访问它?导航项之一可以是标题吗?
谢谢!
编辑: 是的,询问的原因是我需要不同的标题 accessibilityLabel。
最佳答案
你可以使用titleView
例如你可以把代码放在viewDidLoad
方法中
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 300, 44)];
label.text = self.title;
label.textAlignment = NSTextAlignmentCenter;
self.navigationItem.titleView = label;
然后您可以通过更改 View Controller 的标题来更改label.text
关于ios - UIViewController 标题的可访问性标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37061915/