Pintu Rajput
Pintu Rajput

Reputation: 631

How to get image size from image url without downloading in swift

I need image size from URL, When I set image from URL in UITableView cell, Then I need a frame of UIImage so that I can set UIImageView Frame size accordingly. I am using below code

cell.imgPostedImage.sd_setImage(with: URL(string: imageArray[0]),placeholderImage: UIImage(named: "placeholder"),options: 
SDWebImageOptions(rawValue: 0), completed: { (image, error, cacheType,imageURL) in
print(image?.size.height)                                        
cell.imgPostedImage.setNeedsLayout()
})

Upvotes: 1

Views: 342

Answers (0)

Related Questions