This is for a tab bar for an iPhone app, using the Swift coding language in Xcode 6.3
My issue is that I want to add an image into my Tab bar in one of my view controllers, but the image is too large. My original solution to this was to manually decrease the size of the image using preview, but the resolution was poor after doing that. Is there a line of code that I can put into the app delegate that could resize an image without changing the source file? Does anyone know of any other way to solve this problem?
The second image is the goal, but without the resolution loss.
This is not possible.
Check Icon and Image Sizes guidelines from apple. It categorically mentions:
Unlike other custom artwork in your app, the icons and images listed in Table 41-1 must meet specific criteria so that iOS can display them properly.
This applies to the tab bar icons too. So, if your images are larger than the max size (mentioned in above link), you will face such issues. Better resize the images.
If you are worried about poor resolution on retina displays (6, 6+ etc), make sure you provide @2x and @3x images for each tab bar image to Support the Retina display.