1. stringByAppendingString是字符串拼接,拼接路径时要在名称前加“/”
2. stringByAppendingPathComponent是路径拼接,会在字符串前自动添加“/”,成为完整路径
两种方法在拼接同一路径时的代码如下:
NSString *imagePath = [skinPath stringByAppendingString:[NSString stringWithFormat:@"/%@",imageName]];
NSString *imagePath = [skinPath stringByAppendingPathComponent:imageName];
NSLog(@"imagePath:%@",imagePath);