we can add image as pdf in ios assets for application.But i'm confusing that which approach is good for application.
Png file direct drag and drop to Assets
or use image as PDF
i have follows links
https://icons8.com/articles/how-to-use-vectors-in-xcode-7/
and https://bjango.com/articles/idontusepdfs/
but not able to decide which one is better solution for assets.
i know how to works with pdf asset but cannot decide which method is better from development point of view.
Thanks in advance.
If your artwork has complex gradients, generate the PNGs yourself. Otherwise, use PDFs. That's how I read it.
Personally, I have the luxury of working with a designer who just gives me assets at all the required sizes. On another project, Sketch was used which can auto-generate PNGs from a script as part of the build process. So I've never actually used PDFs.
Related
I am loading a remote PDF file and trying to turn it into an UIImage (for showing in an UIImageView), and am surprised that it doesn't seem to work. Even though local PDF files in the Asset Catalog work just fine, is PDF not supported outside of that?
Edit: I found https://developer.apple.com/library/archive/documentation/2DDrawing/Conceptual/DrawingPrintingiOS/LoadingImages/LoadingImages.html which suggests that nope, PDF doesn't work. So that leaves me with the question: why/how does it work for local files in the Asset Catalog? Why or how is that different?
To answer your "Why or how is that different?" question...
When you add a PDF file to asset catalog, Xcode renders #1x, #2x and #3x versions at build-time.
You can select Preserve Vector Data to have the pdf "rendered on-the-fly." This generally works well, although if you have a lot of pdfs and you're doing a lot of manipulation with them, it may reduce performance.
I would like to know if we were to put our images in the xcode Assets.xcasset or an image file could be enough?
Thank you
https://developer.apple.com/videos/play/wwdc2018/219/
From WWDC 2018:
"...for artwork that comes with your application, we strongly encourage you to use image assets. And there are a number of reasons why."
Some of those reasons:
"Image assets are optimized for name based and trait-based lookup. It's faster to look up an image asset in the asset catalog, than it is to search for files on disk that have a certain naming scheme."
"managing buffer sizes"
"...per device thinning, which mean that your application only downloads image resources that are relevant to the device that it's going to run on and vector artwork."
Vector artwork optimization: "...if your image gets rendered in an image view that is larger or smaller than the native size of the image it doesn't get blurry. The image is, actually, re-rasterized from the vector artwork... The asset catalog compiler has, actually, already produced a pre-rasterized version of that image and stored it in the asset catalog. So, rather than doing the complicated math of rasterizing your vector artwork into a bitmap, we can just decode that image that's stored in the asset catalog and render it directly into the frame buffer."
This is not an exhaustive list, click the link for more. So to answer the question, using the asset catalog is certainly not required, but it would be foolish not to use it for artwork that is delivered with the application for the reasons mentioned.
No. It is not required to use .xcassets files. You can also just add images and other resources to your Xcode project.
However I would always use Asset Catalogs if possible, because it gives you powerful features, such as using different images for different devices/gamuts/etc.
Quick question, that I haven't found a solid answer yet.
Is it possible to generate a PDF in iOS that includes layers, which can then be removed/separated in Photoshop?
What I'm trying to achieve is take a picture with the camera of the phone, then place text over it, submit it as pdf to a customer and then have the customer read the text and remove it.
I can do everything except the layering of the pdf and I have found some hints that this isn't possible to do with the standard iOS library, but I wanted to know if anyone has come across this before.
Thank you.
The standard iOS API for creating PDF files cannot create layers (optional content) in a PDF page.
This library IFXPDFFactory seems to be able to generate PDF files with layers.
PoDoFo and libHaru can also be used to generate PDF files on iOS but I do not know if they support layers.
I have an existing Cocos2D game that uses sprite images taken from a .pvr.ccz file, probably generated by TexturePacker. However, I don't have the original PNG images used to create that file, and I need to make some changes to the images in the game. Are there any tools or techniques that I can use to pull the images out of the .pvr.ccz file, or do I need to write my own tool?
Not possible if they use the encryption option of Texture Packer:
I've added a new feature to TexturePacker which helps you to prevent all this from happening. It's called ContentProtection and simply encrypts the images.
Your app will still be able to decrypt the data, but somebody else is going to have a hard time getting it done.
Source: https://www.codeandweb.com/texturepacker/contentprotection
I'm about to write an app for iPad2 to make website offline available.
Several Publications (consisting of one HTML, one Javascript an many PNG Files) need to be downloaded to the iPad for offline Viewing.
Is there a good unzip-class for iOS so that i could download a zip from server and unpack it to a subdirectory in Documents Folder?
http://code.google.com/p/objective-zip/ looks like the right code for your needs.
If compression doesn't matter, the untar algorithm is pretty easy to implement. Either you keep it as plain C, or you adapt it to objective-C.
Reference: http://code.google.com/p/libarchive/source/browse/trunk/contrib/untar.c?r=1143