Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

localize all subviews #8

Open
xaoxuu opened this issue Apr 28, 2017 · 0 comments
Open

localize all subviews #8

xaoxuu opened this issue Apr 28, 2017 · 0 comments

Comments

@xaoxuu
Copy link
Owner

xaoxuu commented Apr 28, 2017

之前我们实现了将某个控件的文本转换成支持多语言的文本NSLocalizedString详见 #3

而在0.0.6以后的版本,你可以用一行代码将本页面所有控件所有文本进行转换:

AXLocalizeAllSubviewsInView(self.view); // available(0.0.6)

这个方法建议在项目成型之前使用,避免了频繁更改造成代码混乱,也能够提高开发效率。

缺点是略微影响性能,可以在项目成型到无需大改的阶段之后删掉此代码,手动替换。

// @xaoxuu: 以下这些方法提供更加灵活的实现,可按需使用。
AXLocalizeLabel(self.label);
AXLocalizeTextField(self.textField);
AXLocalizeTextView(self.textView);
AXLocalizeAllLabelsInView(self.view);
AXLocalizeAllTextFieldsInView(self.view);
AXLocalizeAllTextViewsInView(self.view);

其实只要不那么极致要求性能的话,只要别用在tableview的cell里,一直留在项目里也是没有多大影响的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant