stringByAppendingPathComponent和stringByAppendingString的区别
2016-02-19 10:21
549 查看
转载自:http://arc9.riaos.com/?p=4980
cyy:自我理解,不保证正确,但亲自试验确实可行:若用 stringByAppendingString 则需要手动在名称前加
“/”符号,而stringByAppendingPathComponent则不需要,它会自动添加
stringByAppendingPathComponent和stringByAppendingString的区别:
打印:
2013-11-27 14:44:30.052 Willing[2757:70b] imagePath:/Users/will/Library/Application Support/iPhone Simulator/7.0.3/Applications/DA5B603D-4D07-4425-B7CC-5D49232189BE/Willing.app/tabbar_home.png
cyy:自我理解,不保证正确,但亲自试验确实可行:若用 stringByAppendingString 则需要手动在名称前加
“/”符号,而stringByAppendingPathComponent则不需要,它会自动添加
stringByAppendingPathComponent和stringByAppendingString的区别:
NSString *imagePath = [skinPath stringByAppendingString:[NSString stringWithFormat:@"/%@",imageName]];//stringByAppendingString是在skinPath加后缀的意思 NSString *imagePath = [skinPath stringByAppendingPathComponent:imageName];//stringByAppendingPathComponent是在skinPath后面加上“/”号连接imageName让它成为完整的路径 NSLog(@"imagePath:%@",imagePath);
打印:
2013-11-27 14:44:30.052 Willing[2757:70b] imagePath:/Users/will/Library/Application Support/iPhone Simulator/7.0.3/Applications/DA5B603D-4D07-4425-B7CC-5D49232189BE/Willing.app/tabbar_home.png
相关文章推荐
- Android客户端注入及清除Cookie
- 《从零开始学Swift》学习笔记(Day 68)——Cocoa Touch设计模式及应用之响应者链与触摸事件
- Android取得长宽的问题
- Android开发之开门狗在程序锁中的应用实例
- iOS分类(Category)和类扩展(Extension)的简单区别
- Android控件: 仿探探首页 相册侧滑层叠加载
- 查看Android应用的package name和activity name方面
- 《从零开始学Swift》学习笔记(Day 68)——Cocoa Touch设计模式及应用之响应者链与触摸事件
- Android开发中一些被冷落但却很有用的类和方法
- swift学习笔记-UI篇之UILabel
- Android中listview的item点击时候去掉背景颜色或者设置成透明的
- Android Studio 配置 SVN
- iOS开发ARC内存管理技术要点
- Android释放apk的时候出现问题
- iOS开发证书失效--Missing iOS Distribution signing identity
- IOS设置菜单界面的设计思路
- android studio 更新 Gradle错误解决方法 sync gradle failed
- ListView中固定item的高度
- Apple Pay如何使用?全网最完美攻略(图文教程)!
- iOS开发如何去掉某种类型的警告