需求: // 后台返回的某个实体 reminder = { cost = , type = , template = 可免费做某事{time}分钟,超过将按{cost}K元收费, time = } template 对应的字符串为后台返回,里面会动态出现 {key} 未知个数的key,然后根据 {key} 找到 reminder 实体里面相应的 key 对应的内容,替换 template ,拼成一段完成的话. 我的实现方案: // 公共部分 NSMutableString *title = [[…