Arn*_*aud 5 fonts translation localization ios uistoryboard
我正在使用新的iOS功能来翻译故事板(http://developer.apple.com/library/ios/#referencelibrary/GettingStarted/RoadMapiOS/chapters/InternationalizeYourApp/InternationalizeYourApp/InternationalizeYourApp.html)
这个解决方案的问题,它不适用于我的UILabel子类.
以下是我的UILabel子类的代码:
.H:
#import <UIKit/UIKit.h>
@interface LabelThinText : UILabel
- (void)awakeFromNib;
-(id)initWithFrame:(CGRect)frame;
@end
Run Code Online (Sandbox Code Playgroud)
.m:
@implementation LabelThinText
- (void)awakeFromNib
{
[super awakeFromNib];
[self setFont:[UIFont fontWithName:@"Raleway-Light" size:[[self font] pointSize]]];
}
-(id)initWithFrame:(CGRect)frame
{
id result = [super initWithFrame:frame];
if (result) {
[self setFont:[UIFont fontWithName:@"Raleway-Light" size:[[self font] pointSize]]];
}
return result;
}
@end
Run Code Online (Sandbox Code Playgroud)
我想我错过了从Storyboard.strings文件中获取自动翻译的东西.
有人有想法吗?
谢谢 !
我遇到了同样的问题,出于同样的原因,在标签中设置自定义字体。不过,我的策略有点笼统。我的自定义字体与 Helvetica 类似,因此我在 IB 中使用 Helvetica Neue 作为占位符字体。UILabel 子类将其转换为我的自定义字体,保留字体大小和粗细,因此我可以通过 IB 控制所有这些。
这使得我解决翻译错误(我认为这是一个错误)的方法变得更容易。我在 viewDidLoad 中递归地遍历所有视图,并映射所有 UILabel 字体(如果它们与占位符字体匹配),在我的情况下,对于 UIButton 也是如此。
您提交了错误吗?
| 归档时间: |
|
| 查看次数: |
2192 次 |
| 最近记录: |