自定义网络请求图片的大小

作者: 且行且珍惜_iOS | 来源:发表于2016-03-07 16:51 被阅读428次
    NSURL *url = [NSURL URLWithString:[[self.imageSource objectAtIndex:indexPath.section] objectAtIndex:indexPath.row]];
    
            UIImage *icon = [UIImage imageWithData:[NSData dataWithContentsOfURL:url]];
    
            CGSize itemSize = CGSizeMake(30, 30);
    
            UIGraphicsBeginImageContextWithOptions(itemSize, NO,0.0);
    
            CGRect imageRect = CGRectMake(0.0, 0.0, itemSize.width, itemSize.height);
    
            [icon drawInRect:imageRect];
    
            cell.imageView.image = UIGraphicsGetImageFromCurrentImageContext();
    
            UIGraphicsEndImageContext();

    相关文章

      网友评论

        本文标题:自定义网络请求图片的大小

        本文链接:https://www.haomeiwen.com/subject/xaaakttx.html