Search code examples
iosuiimageviewuiimageborderlaunch-screen

How to add a border to an UIImageView located on the LaunchScreen?


How can I add a border to an UIImageView which is located on the LaunchScreen of an iOS App?

I already tried to do it programmatically and to add user defined runtime attributes (which is not allowed).


Solution

  • You cannot programmatically do this, however...

    If you add an actual border to your bitmap image, the border will get "pixel-stretched" for different screen resolutions.

    Another option (which would avoid that issue): You could add a UIView, set its background color to the color you want for your border, and add your UIImageView as a subview, with constraints set to 1 or 2 points to give it the desired "border width".