iOS 中文转拼音

NSString *ni = @"你好";
NSMutableString *niHao = [ni mutableCopy];
//先转化为带声调的拼音
CFStringTransform((__bridge CFMutableStringRef)niHao, NULL, kCFStringTransformMandarinLatin, NO);
//去掉重音和变音符号
CFStringTransform((__bridge CFMutableStringRef)niHao, NULL, kCFStringTransformStripCombiningMarks, NO);

你可能感兴趣的:(iOS 中文转拼音)