mchoe / SwiftSVG

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

SVGView height width constraints are just ignored #87

Open schwindt opened 6 years ago

schwindt commented 6 years ago

I have a SVGView with fixed height and width constraints which are just ignored. The svg file will be shown just in original size, in my case 1024 X 1024. If I don't use the SVGView and a UIView instead an do this let svgView = UIView(SVGNamed: "entrance") { (svgLayer) in svgLayer.resizeToFit(self.testView.bounds) } svgView.backgroundColor = UIColor.blue self.testView.addSubview(svgView) It's working.

mchoe commented 6 years ago

Hi @schwindt, can you please provide an example SVG? Thanks.

deets commented 5 years ago

SwiftSVG-test-case.zip

Disclaimer: I'm very very new to iOS programming. However I experienced something akin that looks as if the "promise" of auto-scaled views is not fulfilled.

I would expect the used SVG to be rendered into the SVGView. Instead only the marker I placed in the lower corner is shown. If I remove the constraints the SVG is shown, but full scale.

You can find the project here

https://github.com/deets/deets-fpv-vtx-scanner/tree/master/VTX%20Scanner

if that helps you.

Schnodderbalken commented 5 years ago

Same here. Example image: https://www.patavinus.com/static/images/company-logos/5/logo.svg