Answers for "swiftUI image scale to fixed width"

7

set image width and height swiftui

Image(room.thumbnailImage).resizable()
.frame(width: 32.0, height: 32.0)
Posted by: Guest on March-13-2020
1

swift set image size

extension UIImage {

    func imageResize (sizeChange:CGSize)-> UIImage{

        let hasAlpha = true
        let scale: CGFloat = 0.0 // Use scale factor of main screen

        UIGraphicsBeginImageContextWithOptions(sizeChange, !hasAlpha, scale)
        self.draw(in: CGRect(origin: CGPoint.zero, size: sizeChange))

        let scaledImage = UIGraphicsGetImageFromCurrentImageContext()
        return scaledImage!
    }

}
Posted by: Guest on March-04-2020

Code answers related to "swiftUI image scale to fixed width"

Code answers related to "Swift"

Browse Popular Code Answers by Language