如何对情节提要进行本地化带有静态单元格的UITableView标头

时间:2018-08-03 14:14:16

标签: ios uitableview localization storyboard

关于如何使用情节提要如何对带有静态单元格的UITableView的节标题进行本地化,我找不到任何内容。

我试图获取Table View Section的ID并定位其Header,但是它不起作用。从来没有接受我的本地化。

"eBi-dg-Pbw.header" = "my string";
"eBi-dg-Pbw.text" = "my string";
"eBi-dg-Pbw.title" = "my string";

enter image description here

enter image description here

enter image description here

我实现了- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section来本地化我的版面,但我想知道是否有一种使用情节提要进行本地化的方法。

谢谢!

1 个答案:

答案 0 :(得分:0)

第一个选项-故事板.strings文件中的名称错误。正确的是:

"eBi-dg-Pbw.headerTitle" = "This is the header localisation";
"eBi-dg-Pbw.footerTitle" = "This is the footer localisation";

第二个选项-您需要在Interface Builder的静态部分元素中为 Header Footer 填充默认(虚拟)值。在您的屏幕截图中,仅在 Header 字段中填充了值“我的标题字符串”,并且 Footer 留空了

之后-您不再需要通过ViewController代码实现本地化