我使用此代码Objective C
更改语言PickerView
:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.dicke = [[NSArray alloc]
initWithObjects:@"0.0",@"0.5",@"1.0",@"1.5",@"2.0",@"2.5",@"3.0",@"4.0",@"5.0",@"6.0",@"8.0",@"10.0",@"12.0",@"15.0",@"20.0", nil];
NSString *userLocale = [[NSLocale currentLocale] localeIdentifier];
NSLog(@"%@", userLocale);
if ([userLocale isEqualToString:@"de_DE"]) {
self.Material = [[NSArray alloc]
initWithObjects:@"Stahl",@"Aluminium",@"Edelstahl",@"Kupfer", nil];
}
else
self.Material = [[NSArray alloc]
initWithObjects:@"Steel",@"Aluminum",@"Stainless",@"Copper", nil];
}
我怎样才能做到这一点Swift
,或者有另一种方法来翻译PickerView
. 对不起这个愚蠢的问题,但我真的是一个初学者Swift
。