Keep Image Size Proportional + Work with SVG - ios

Language : Swift 3 ---- IDE : Xcode 8 ---- iOS SpriteKit Project
I use a png image loaded in Assets.xcassets and used in program as SpriteKitNode. I created the project working on iPhone SE Simulator. Although If I run the game on another iPhone or iPad images still stay small. (I have the same image made also for x2,x3). Is there a way to load an image and use it proportional to the screen size?
Also I read that on iOS the best image format to work with is SVG. Does anyone know how to work with it? I tried to load a svg image on Assets.xcassets but it doesn't load. Then I dragged the svg image in my project and still couldn't load it on a SpriteKitNode.

Xcode doesn't support SVG yet. It does support PDF though so if you can export/save your SVG as a PDF, you can import that into your assets catalog and get all the scaling goodness of SVG.

Related

Strange glowing effect on PDF image assets in iOS?

I am having an issue where the images are rendered with a strange glowing effect around them, pictured here:
It is tough to see from this close but is extremely noticeable when viewing the app. Also, taking these screenshots into a design program and using the color dropper will prove that there is a glow around these images. Each of these images are PDF files, rendered as a template image so that I can change the tintColor instead of adding more images to my assets folder for each color.
I have read some other articles and questions that says there isn't full support for vector graphics yet (here). However, that is outdated as it specifies iOS 7 as the latest version at the time of writing. Now in iOS 13, I assume there have been changes. Another article I read said to never use vector graphics as they can get messed up when Xcode generates PNGs from the PDFs (here).
Information about the assets in my Images.xcassets:
Render as: Template Image
Resizing: Preserve Vector Data
Scales: Single Scale
I also tried to implement 3 PNGs at different sizes (#1x, #2x, #3x) for each image but got the same effect.
Creating new images with a smaller border size got rid of the glow but obviously, that doesn't fit the design style style that I want in an app. I designed these Icons in Sketch and used a border size of 3, then exported as PDF.
So, as I was writing this question I seemed to have found an answer.
It turns out it had nothing to do with anything in Xcode. The problem lies with Sketch. I redesigned each element in Adobe Illustrator, exported them as PDFs, set the same settings in the assets folder like so:
Render as: Template Image
Resizing: Preserve Vector Data
Scales: Single Scale
Here are the updated screenshots:
I am using:
Sketch (Version 52.5)
Adobe Illustrator (Version 24.2.1)
I don't know why this is an issue, but I hope it can help someone who has this issue down the road. If anyone has any more information on this, please write a comment :).

React Native app doesn't load #1x, #2x or #3x image to the right screen density

I am developing a iOS/Android app using React Native. According to the documentation at this link https://facebook.github.io/react-native/docs/images
React native places the correct image size according to your device screen density.
When developing I do as the tutorial on the link above but react native bundles de img.png always and doesn't place the #2x or #3x image which are bigger.
I don't know if this is only done when the bundle is created for launching the app or so! Please help, I am struggling
Also, which is the better flux, process or way to design one screen size in psd and get all assets for multiple screen sizes from it?
Thanks in advance
as react-native doc image should be named accordingly
in development mode images will be bundled to app but you can link images in native project folder as drawable in android
so if you use different builds for your app you will use that density images
ps : a dirty workaround inorder to test your app in dev mode is, providing other image for #2x or #3x image sizes
I had the same issue - my #2x and #3x images weren't being loaded when I compiled and ran my app on phones with those screen densities, after I added them to the project.
But when I stopped and closed the bundler (terminal) and restarted it (new terminal window), it packaged and displayed the correct density images on the correct devices' screens.

Unity Package Size issue

I am working on unity game. For single project have lot of scenes and resources and images files. In android it's working fine. But iOS it's not working. For iOS reduced the Image size as 1k from 4k. Some of the images have the blur issue but app working fine. I changed some of the image alone to the 2k and try to run the app images are not loading. Please anyone help me on that.
check this steps:
try to compress images for iOS, https://docs.unity3d.com/Manual/class-TextureImporterIos.html
do not use textures larger than 2048px
pack your image resources with Sprite Packer: https://docs.unity3d.com/Manual/SpritePacker.html

WatchKit Force Menu Custom Icons Blurry

I'm creating custom icons for the WatchKit Force Menu. The documentation says to use an 80 x 80 size image with a drawing area of 54px square. All that works fine, but my image, when displayed in the button, looks very blurry compared to the built-in button images.
I'm creating them in Illustrator at 80px square. Saving as a .png image like the documentation says. Sizing is correct when saved at 72 dpi. If I do anything higher it causes the image in the button to be too large. I cannot find a way to scale the image.
Has anyone run into this? It seems like I would want to use a higher resolution image here or vector graphics.
You need to save the file with #2x in the filename to support retina displays.
So if your filename is myicon.png rename it to myicon#2x.png. In code you just use myicon for the name, Xcode automatically picks the correct size.
For iPhone 6, #3x is required...
I would recommend to use the Images.xcassets in Xcode for maintaining all images. There are templates for all needed resolutions (#1x, #2x, #3x, ...). Create the icons in these several resolutions and drag the files from finder to the placeholders. Later in your code you simply use the name of the image set in Xcassets.

Xcode 6: pdf vector images with transparency

Xcode 6 now has support for pdf vector-based images in asset catalogs. Is it possible to create pdf vector-based images with transparency?
Yes, this is certainly possible, I tried adding a PDF as vector based image in a test project, and the backgroundcolor properly showed trough.
What are you having trouble with?

Resources