iOS Firebase Image #2x #3x - ios

I have search all over internet, and cant find a solution.
How do you deal loading images from Firebase to support iOs #2x and #3x resolutions?
I know how to load an image from Firebase but not how to handle the different resolutions Issue.

A possible solution is to retrieve the PDF version of the resource a SVG version of it and manipulate it in iOS. Actually you cannot convert on the fly this kind of file, you need to convert it...

Related

iOS: using SVG (PocketSVG) for hundreds of image assets

One of our team member is urging to use SVGs using github.com/pocketsvg/PocketSVG, instead of regular assets #1x #2x #3x. We have over a hundred image sets.
I have 2 questions:
1) 100s of SVG data rendered using PocketSVG or even another library, is that gonna be a performance kill?
2) Using SVGs over regular assets, going to make any different visually, though our designer have these all images extracted properly using vectors.
Thanks in advance.
Answer for first Question : Yes, Whenever trying to show an image on the screen, it will process your SVG file and create a new image assets. May be the library can cache the image to avoid second time processing.
You no need to use PocketSVG if you have all SVG images on your Asset Catalog. Because Xcode Asset catalog itself able to handle the SVG images.
Xcode will create #1x #2x #3x images from SVG file at the time of compilation.
Answer for second Question : SVG is a vector image. You can extract good quality image from svg. You will not get any different by using #1x #2x #3x images or SVG image.
The advantage of using SVG is no need to create one more asset #4x if Apple introduced another different screen resolution devices. Just recompile the code Xcode will create on behalf of you
Refer the link : How to use vector in Xcode

How to use Vectors in Xcode 8

I'm looking for solution of problem that I get image from my server and that image will be only be one(not for compatible all devices) and that image will also use in android device too so as you know android support SVG but iOS isn't (that 1 image should be use on all iOS devices even on iPad too). I look into this Tutorial and this use from PDF and also use local pdf.
So what will be approach from iOS end or server end to download 1 image (with one size) and will be show on all devices.
Looking for suggestions and help to resolve this issue.
You can try to implement PocketSVG (https://github.com/pocketsvg/PocketSVG) to do that.
There is one downfall though: it only supports SVG features that can be drawn using CGPaths or UIPaths.

Photo Size and Resolution for iOS app

I am working on an iOS application that will show photos either in full screen or in frames in various sizes - like product catalog.
I know I am supposed to use images.xcassets to make things simple and I know I am supposed to create more than one version of the same photo in different sizes.
All I can find is AppIcon and LaunchImage guidelines. What would be the rules I should follow preparing photos to show in different devices? Sizes, resolutions?
Sample: I have 2048 x 1536 raw sized photo (even bigger ones). When it comes to prepare it for iOS app (will work both in iPad and iPhone), what are the dimensions to export my photos from PhotoShop? What would be the biggest sized version?
Could someone please show me a starting point to understand this?
Thanks in advance.
This design guidelines guide is very good. You will find everything you have to know about sizes.
But the simplest way is to use a tool like Asset Catalog Creator to generate your assets. Just drop your original image in it, select your #1x size, and it will generate the catalog for you, for all sizes.
Here is a screen size reference for iPhone devices you may find helpful. Here's one for iPads.
Additionally, if you've got a lot of files you need to resize that you've already exported, you might consider using ImageMagick for batch resizing.

iOS - Can we convert vector pdf to pngs at run time?

http://martiancraft.com/blog/2014/09/vector-images-xcode6/
I have supported vector pdfs through out the project by adding pdfs in xcassets like this:
So when we build our project, Xcode convert pdf into #1x, #2x, and #3x PNG files. And when we run the application, iOS automatically pick the appropriate #1x, #2x, or #3x image that Xcode generated based on the device requirements.
Issue:
In one screen, our icons are dynaminc. That means we get pdf images through API. I am not sure how xcode can convert these pdfs at run time.
Please help!
There is a library called UIImage-PDF which you can use to load your PDFs into a UIImage at runtime. https://github.com/mindbrix/UIImage-PDF

Use JPEGs for Launch Images

This is related to Default-Portrait.png for iPad: any way to make the file size smaller?
Is there any way to specify a more efficient file format (like JPEG) for Default-Landscape.png
and Default-Portrait.png?
Yes it's possible to use jpg files as launch images. Just add "Launch image" key with the base filename (e.g. LaunchImage.jpg") to the Info.plist. Then add files to your project such as
LaunchImage.jpg
LaunchImage#2x.jpg
LaunchImage-568h#2x.jpg
and Xcode will pick them up.
However through personal experience I've discovered if you're supporting the larger iPhone 5 screen the App Store expects PNG format and uses the presence of PNG to determine iPhone 5 support and display of iPhone 5 size thumbnails on the store. Using JPG images will not show the app as iPhone 5 optimized in the app store (even though it will work fine on the device) so it is best to stick with PNG.
There is no way to use an image other than a png.
All launch images must be PNG files and must reside in the top level of your app’s bundle directory. Section: App Launch (Default) Images
Update: JPEG images to work and Apple's documentation no longer specifies that the images must be PNG files.
If you use xcassets, then since Xcode 6 you can use JPGs. However Xcode will still not let you drop JPGs into the LaunchImage folder. But you can do it in Finder. Simply drop your PNGs into that folder with Finder and then edit the JSON file changing all .png extensions to .jpg.
I haven't submitted an app to the store using this yet, but it works in the iPhone simulator at least.
Update: Doesn’t work on the device. I’ll leave this answer here anyway so people know that this technique was at least tried so the effort won’t be repeated.

Resources