As Apple introduced the PDF support for the Xcode Image Asset Catalog I was wondering if it's also possible to add PDFs at runtime?
What I want is to download my PDF-Assets and use them similar to JPGs or PNGs in my App with the difference that I only need one instead of 3 resolutions.
use this link it will help you
http://alldonegoodbye.tumblr.com/post/97647217699/xcode-6-vector-image-support-pdf
Related
I wanna build an electron project that will be used to take screenshots and save them. But the main problem is that I don't know how to do this using javascript. I have found a couple of answers but they all included some libraries (mostly html2canvas). So could you give the working code to take screenshots using javascript with no library?
here's how to draw dom into a canvas.
After drawing it on canvas,you can download it by creating canvas's URL.
I am a newbie on iOS development and am developing my first serious app (Objective C).
I am using an external API and have gotten to a point where I need to download an image from said API to keep offline as cache.
Now, if I understood correctly I can add images to my app on XCode using the asset catalog. For example, if I add an image with image#1X.png, image#2X.png and image#3X.png versions, in order to use them later I only need to provide the "image" part to iOS and it will automatically return the version appropriate for the currently used device.
I cannot however add images to the asset catalog on runtime - I must create an NSData from the image URL and save it to the Documents folder.
The thing is, this API gives me a bunch of URL's for different versions of the image I need to download and among them are the #2X, #3X etc versions of the image, so I need to download all versions and use the asset catalog feature of retrieving the appropriate one for the device.
How can I achieve this?
Thank you very much in advance for your help and please correct me if I got something wrong.
so I need to download all versions and use the asset catalog feature of retrieving the appropriate one for the device.
You don't need to. We add 2x and 3x images to our asset catalog because we don't know on what device our app is running. But in your case, you need to know this at runtime, so you already know what's the device.
To get the scale factor for your device you can do:
UIScreen.mainScreen().scale
So, for 2x this will return 2 and for 3x it will return 3.
From this, you can know what's the proper image you need to download from your API instead of downloading them all which would add unneeded overhead.
You can check the document on the UIImageAsset if it helps in your requirement
Also as you say you are newer to iOS development you can check file system document also which helps you in understanding and managing file in better way
File System basics
Edit: as mentioned by sateesh and patchdiaz, it will be better solution to download only single resolution images for the particular device instead of downloading all resolution images for a device
I have really large number of images just in Images folder of my project (just #1x and #2x.png files). It's time to support #3x displays and I've decided to move to assets catalog. Are there any tools/scripts to automate this?
Normally you already have an Asset Catalog because of your AppIcon. If not, choose File:New:File ... and then select iOS Resource:Asset Catalog.
The images you want to import should be named properly: image.png, image#2x.png. If you target both devices: image~iphone.png, image#2x~iphone.png, image~ipad.png, image#2x~ipad.png.
Then select Asset Catalog and press +. Choose the folder with the images you want to import.
Like that it´s very simple to import large numbers of pictures and you can have the same folder structure in your Asset Catalog, as you had before.
You can try iMigrate, that I created recently. So it wasn't properly tested and you can use it own risk.
You can make one of your own using Apple Automator. It is an automating script maker tool provided by Apple with the Mac OS. You can find plenty of online tutorials for it if you Google it up. Here's an example. Click here
I found some image include in iOS framework, How can I use this image in my program?
You could extract the images using https://github.com/0xced/UIKit-Artwork-Extractor.
Please note, however, that Apple might not like it if you use their images in your app.
For example, using the GameCenter icon on a custom view/control is prohibited.
If the image is just part of UIKit, it won't be such a big problem, I guess.
Hope this helps
No . That's not possible and legal
Because of we cannot use third party and default framework images it's based on the legal issue in AppStore. So better to use control and views. Don't alter default framework images.
What types of files can the built in iPad UIWebView handle natively? It seems to handle PDF files and image files fine with loadRequest URL's, but it can't handle Excel spreadsheets. What is the complete list of files that it is capable of showing natively?
Apple's documentation is here:
http://developer.apple.com/iphone/library/qa/qa2008/qa1630.html#//apple_ref/doc/uid/DTS40008749
They claim it does support Excel (.xls); perhaps you have a xlsx or a problem with mimetypes on the server? (Though that list is the iPhone OS 3.0 list, but I can't see why they'd have removed any supported formats on the iPad.)