+ (NSString *)transform:(NSString *)chinese
{
NSMutableString *pinyin = [chinese mutableCopy];
CFStringTransform((__bridge CFMutableStringRef)pinyin, NULL, kCFStringTransformMandarinLatin, NO);
CFStringTransform((__bridge CFMutableStringRef)pinyin, NULL, kCFStringTransformStripCombiningMarks, NO);
NSLog(@"%@", pinyin);
return [pinyin uppercaseString];
}
用kCFStringTransformMandarinLatin
方法转化出来的是带音标的拼音,
如果需要去掉音标,则继续使用kCFStringTransformStripCombiningMarks
方法即可,执行这行代码。
http://www.jianshu.com/p/5b0c958f4092