stringByAppendingPathComponent 是路径拼接会多出“/”
stringByAppendingString 是字符串拼接无“/”
NSString *imagePath1 = [@"str1" stringByAppendingString:@"str2"];
NSString *imagePath2 = [@"str1" stringByAppendingPathComponent:@"str2"];
NSLog(@"imagePath1:%@ imagePath2:%@",imagePath1,imagePath2);
输出结果:imagePath1:str1str2 imagePath2:str1/str2
网友评论