我有这个DDUnitConverter用于货币转换的代码.
#import "DDUnitConverter.h"
#import "DDCurrencyUnitConverter.h"
- (void) convertCurrency {
DDUnitConverter *converter = [DDUnitConverter currencyUnitConverter];
NSNumber *from = [NSNumber numberWithInt:42];
NSNumber *to = [converter convertNumber:from fromUnit:DDCurrencyUnitUKPoundSterling toUnit:DDCurrencyUnitUSDollar];
NSLog(@"new value: %@", to);
}
Run Code Online (Sandbox Code Playgroud)
我想根据用户的选择设置fromUnit:和toUnit:参数.我该怎么办?