Get the dimensions of an image through a url in swift

1

How can I get the dimensions of an image that is in a url from swift ??

at the moment I have this code to show the image:

imagenPrincipal.contentMode = .ScaleToFill
let URL = NSURL(string: oferta!.imagen)!
let placeholderImage = UIImage(named: "placeholder")!
imagenPrincipal.sd_setImageWithURL(URL, placeholderImage: placeholderImage, completed: nil)

I use AlamofireImage to show the image

I need to modify the size of the image according to the width of the screen and the size of the image keeping the aspect ratio

Thanks

    
asked by 07.07.2016 в 12:20
source

1 answer

0

If you want to resize the image and the height according to the screen size, use the equal height and the equal width image equal width to view as contraints and handle the proportion that you want to give the multiplier property of the constraint, in this way the image will grow that percentage that you indicate in the multiplier depending on the size of the view.

    
answered by 08.07.2016 в 17:33