字符串转化为数组和url转化为UIImage对象

1. 字符串转化为数组

NSString *strings =@"1,2,2,3,4";
 //按照,分隔成数组
NSArray *srray = [strings componentsSeparatedByString:@","];
NSLog(@" 结果是srray =%@", srray);

2. url转化为UIImage对象


-(UIImage *) getImageFromURL:(NSString *)fileURL {
    
    UIImage * result;
    NSData * data = [NSData dataWithContentsOfURL:[NSURL URLWithString:fileURL]];
    result = [UIImage imageWithData:data];
    return result;
}

你可能感兴趣的:(字符串转化为数组和url转化为UIImage对象)