OC - stringByAppendingPathCompon
作者:
千山小畻 | 来源:发表于
2016-06-19 17:09 被阅读4071次1. stringByAppendingString是字符串拼接,拼接路径时要在名称前加“/”
2. stringByAppendingPathComponent是路径拼接,会在字符串前自动添加“/”,成为完整路径
两种方法在拼接同一路径时的代码如下:
NSString *imagePath = [skinPath stringByAppendingString:[NSString stringWithFormat:@"/%@",imageName]];
NSString *imagePath = [skinPath stringByAppendingPathComponent:imageName];
NSLog(@"imagePath:%@",imagePath);
本文标题:OC - stringByAppendingPathCompon
本文链接:https://www.haomeiwen.com/subject/trvbdttx.html
网友评论