mchoe / SwiftSVG

A simple, performant, and lightweight SVG parser
Other
1.92k stars 230 forks source link

Image is displayed way too big #157

Open Schnodderbalken opened 4 years ago

Schnodderbalken commented 4 years ago

Description of the Issue I have an SVG image which I load from a URL and position with programmatically with translatesAutoresizingMaskIntoConstraints = false and NSLayoutConstraints. If I use a usual UIImageView (with a static rendered image) then everything is fine. Using an SVGView creates the mentioned problem (see screenshot below).

Sample SVG https://www.patavinus.com/static/images/company-logos/5/logo.svg

Screenshots Using SVGView: https://pasteboard.co/ICdMugc.png Using UIImageView: https://pasteboard.co/ICdMPfA.png

Sebulec commented 4 years ago

@Schnodderbalken did you try setting boundingBox to your SVGView object? eg. let svgView = UIView(URL: url) { (svgLayer) in svgLayer.boundingBox = CGRect(x: 0, y: 0, width: 300, height: 300) }