SwiftSVG icon indicating copy to clipboard operation
SwiftSVG copied to clipboard

Center SVG

Open toonvanstrijp opened this issue 8 years ago • 1 comments

I can't figure it out how to center my SVG... screen shot 2017-11-27 at 23 34 47 The code I'm using:

 let icon = UIView(SVGNamed: "icon_english") { (svgLayer) in
       svgLayer.fillColor = UIColor.white.cgColor
 }
 icon.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5)
 self.layout(icon).width(size).height(size).edges().center()

toonvanstrijp avatar Nov 27 '17 22:11 toonvanstrijp

Hi @ToonvanStrijp. Without knowing too much about your icon_english SVG, can you make sure that there isn't any space around the shapes themselves? The library doesn't (and shouldn't) make assumptions about cropping any whitespace space around the graphic. Based on this, it looks like your graphic may have some extra space at the top.

You can also post the SVG file here and I'll be able to better assess the situation.

mchoe avatar Nov 28 '17 15:11 mchoe