StringByAppendingPathComponent和stringByAppendingString的区别
2024-09-23 19:28:27
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 开发快速导引:Android程序框架【草】
- GenomicRangeQuery /codility/ preFix sums
- java抽象类与接口 详解
- Linux命令(1)-创建文件
- Android实现SharePreferences和AutoCompletedTextView
- android moveTaskToback 应用退到后台,类似最小化
- 《深入理解linux内核架构》第二章 进程管理和调度
- 茴香豆的第五种写法---设置ExpandableListView系统自带图标按下效果
- java内存模型6-final
- 【53】java的多线程同步剖析
- layout 的应用
- BZOJ2282 SDOI2011消防/NOIP2007树网的核(二分答案+树形dp)
- ML: 降维算法-LE
- CSS样式----css样式表和选择器(图文详解)
- fedora arm-linux-gcc4.4.3编译u-boot-2010.3
- jquery插件导出word:jquery.wordexport.js
- iOS 折线图、柱状图的简单实现
- BZOJ3834 [Poi2014]Solar Panels 【数论】
- 14、Java中用浮点型数据Float和Double进行精确计算时的精度问题
- IOS -执行时 (消息传递 )