stringByAppendingPathCom
NString * str=@“tmp”;
str=[stringByAppendingPathCom
str就变成 tmp/hello.png了
如果是stringByAppendingPathExt
str=[str
str就是 str.jpg
本文介绍了NSString类中两种处理文件路径的方法:stringByAppendingPathComponent用于添加路径组件来形成完整路径,stringByAppendingPathExtension则用于添加文件扩展名。通过具体示例展示了这两种方法的实际应用。

被折叠的 条评论
为什么被折叠?