stringByAppendingString是字符串拼接,拼接路径时要在名称前加“/”;
stringByAppendingPathComponent是路径拼接,会在字符串前自动添加“/”,成为完整路径。
例如:
NSString *imagePath = [skinPath stringByAppendingString:[NSString stringWithFormat:@"/%@",imageName]];
NSString *imagePath = [skinPath stringByAppendingPathComponent:imageName]; NSLog(@"imagePath:%@",imagePath);