'UIImage would always crop of no matter what content fit mode you use, with or without constraints
This image would always cut off on its bottom-right edge, I am out of clue and spent a few hours into it, I suspected that it's the fact that it is an SVG, and iOS could not render it well, or maybe there is something I am missing, but I converted it into pdf or png using an online tool and with the same code, it does not get cut off, so I was able to move on. I would be grateful if you could have looked into it if this is an actual XCode/iOS bug.
I tested the same code on XCode 12 and iOS 14 and the image does not get cropped
To reproduce, just add this svg as an asset and put it on an UIImage.
<?xml version="1.0" encoding="UTF-8"?>
<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>BE1CD1AB-5A15-49D9-B85E-7D93717CC66A</title>
<defs>
<rect id="path-1" x="0" y="0" width="32" height="32"></rect>
</defs>
<g id="Notification---English" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="07---Notifications-center---Grouped---Unread-notifications" transform="translate(-36.000000, -282.000000)">
<g id="Group-2" transform="translate(16.000000, 116.000000)">
<g id="Group-2-Copy" transform="translate(16.000000, 162.000000)">
<g id="💎-Icone-Copy-2" transform="translate(4.000000, 4.000000)">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<use id="mask" fill-opacity="0" fill="#FFFFFF" xlink:href="#path-1"></use>
<g id="shape" mask="url(#mask-2)">
<g transform="translate(4.000000, 4.000000)" id="Shape">
<path d="M5.33333333,16.04736 C6.069713,16.04736 6.66666667,16.6443137 6.66666667,17.3806933 L6.66666667,21.3806933 C6.66666667,22.117073 6.069713,22.7140267 5.33333333,22.7140267 L1.33333333,22.7140267 C0.596953667,22.7140267 0,22.117073 0,21.3806933 L0,17.3806933 C0,16.6443137 0.596953667,16.04736 1.33333333,16.04736 L5.33333333,16.04736 Z M17.3333333,16.04736 C18.069713,16.04736 18.6666667,16.6443137 18.6666667,17.3806933 L18.6666667,21.3806933 C18.6666667,22.117073 18.069713,22.7140267 17.3333333,22.7140267 L13.3333333,22.7140267 C12.5969537,22.7140267 12,22.117073 12,21.3806933 L12,17.3806933 C12,16.6443137 12.5969537,16.04736 13.3333333,16.04736 L17.3333333,16.04736 Z M15.576009,3.65683571 L18.9692259,7.05005259 C19.489925,7.57075165 19.489925,8.41497162 18.9692259,8.93567067 L16.8883427,11.0165539 C16.3676436,11.537253 15.5234236,11.537253 15.0027246,11.0165539 L11.6095077,7.62333706 C11.0888086,7.102638 11.0888086,6.25841803 11.6095077,5.73771897 L13.690391,3.65683571 C14.21109,3.13613665 15.05531,3.13613665 15.576009,3.65683571 Z M5.33333333,4.04736 C6.069713,4.04736 6.66666667,4.64431367 6.66666667,5.38069333 L6.66666667,9.38069333 C6.66666667,10.117073 6.069713,10.7140267 5.33333333,10.7140267 L1.33333333,10.7140267 C0.596953667,10.7140267 0,10.117073 0,9.38069333 L0,5.38069333 C0,4.64431367 0.596953667,4.04736 1.33333333,4.04736 L5.33333333,4.04736 Z" fill="#F7738E" fill-rule="nonzero"></path>
<path d="M8,13.3806933 C8.7364,13.3806933 9.33333333,13.9776267 9.33333333,14.7140267 L9.33333333,21.3806933 C9.33333333,22.1170933 8.7364,22.7140267 8,22.7140267 L1.33333333,22.7140267 C0.596933333,22.7140267 0,22.1170933 0,21.3806933 L0,14.7140267 C0,13.9776267 0.596933333,13.3806933 1.33333333,13.3806933 L8,13.3806933 Z M20,13.3806933 C20.7364,13.3806933 21.3333333,13.9776267 21.3333333,14.7140267 L21.3333333,21.3806933 C21.3333333,22.1170933 20.7364,22.7140267 20,22.7140267 L13.3333333,22.7140267 C12.5969333,22.7140267 12,22.1170933 12,21.3806933 L12,14.7140267 C12,13.9776267 12.5969333,13.3806933 13.3333333,13.3806933 L20,13.3806933 Z M8,14.7140267 L1.33333333,14.7140267 L1.33333333,21.3806933 L8,21.3806933 L8,14.7140267 Z M20,14.7140267 L13.3333333,14.7140267 L13.3333333,21.3806933 L20,21.3806933 L20,14.7140267 Z M15.7238667,0.39052 C16.2044821,-0.09012 16.9608276,-0.127092308 17.483863,0.279603077 L17.6094667,0.39052 L22.3234667,5.10456 C22.8042051,5.58521231 22.841185,6.34151527 22.4344063,6.86457537 L22.3234667,6.99018667 L17.6094667,11.7042933 C17.1288513,12.1849087 16.3725057,12.2218791 15.8494703,11.8152046 L15.7238667,11.7042933 L11.0098667,6.99018667 C10.5291282,6.50953436 10.4921483,5.7532314 10.898927,5.2301713 L11.0098667,5.10456 L15.7238667,0.39052 Z M16.6666667,1.33333333 L11.9526667,6.04737333 L16.6666667,10.76136 L21.3806667,6.04737333 L16.6666667,1.33333333 Z M8,1.38069333 C8.7364,1.38069333 9.33333333,1.97765333 9.33333333,2.71402667 L9.33333333,9.38069333 C9.33333333,10.1170933 8.7364,10.7140267 8,10.7140267 L1.33333333,10.7140267 C0.596933333,10.7140267 0,10.1170933 0,9.38069333 L0,2.71402667 C0,1.97765333 0.596933333,1.38069333 1.33333333,1.38069333 L8,1.38069333 Z M8,2.71402667 L1.33333333,2.71402667 L1.33333333,9.38069333 L8,9.38069333 L8,2.71402667 Z" fill="#000000" fill-rule="evenodd"></path>
</g>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

