Storing custom images in iPad application for use in App - ios

I am making an iPad application (iOS 5.0/5.1 with ARC and storyboard) for which I need to download an image or sound file from my server and then use it as background for all the screens of my application. I was thinking of keeping a placeholder image/audio file bundled within my application which I will refer to within the storyboard. Then when I get the file from the server, I can replace that image with the one coming from the server. However, I'm not sure if this can be done based on the directories that the app has access to.
Pls let me know if you can direct me whether it's possible to go down this road? and if yes, then which directory should I be downloading the image files to?
Thanks in advance for your help

Related

Working with custom user files

I'm currently studying swift and came up with such a question:
What are best practices to work with custom user files like .pdf, .doc?
For instance, I have application, that loads different files from server like .pdf, .ppt, .zip and so on, how to present them inside my app?
While googling I came up with solutions mainly for images, but nothing particular for other file types.
For now, what I have is - downloading files from server using Alamofire and saving them to documents directory.
Could anyone please recommend how to present this files inside my app after I saved them?
Possible solution that comes to my mind is web view, but what about zip? Is there some kind of universal solution? I know that there is Files App in iOS 11, but what about iOS 10?
Many thanks for your attention!

How to embed images and sounds in an iPhone app?

I am having a real hard time understanding how to embed many images and sounds in an iPhone app. When I say embed, I mean I want the images and sounds to be downloaded with the app, and some of those images will appear when the app is run. Other images are just saved in the app's disk space, so that when a user presses a button, the image or sound will be accessed and displayed or played.
I have read tutorials on using 'core data' and such, but that only seems like a way to create objects that can be used to reference such data items, or for storing small files as binary data. Can someone please tell me how in xcode I can specify a directory of images and .mp3s to be loaded onto a phone with my app, and how I can then call those media with code?
Some example code for the following would completely solve my problem:
An app is loaded onto a phone, and it contains 3 buttons. If the user presses button #1, a sound is heard. Button #2 plays a different sound, and button #3 changes a UIImageView to a different picture. (this isn't a homework assignment or something, but if I could code this example, I could do everything I need to in my app and understand the process)
Thanks!
I mean I want the images and sounds to be downloaded with the app
Simply add the images and sounds to your project. Make sure you specify (in the Add Files to Project dialog) that they are to copied into the project and that they are to be part of the target. The result will be that the images and sounds will be built into your app (in what is called its bundle, in particular the main bundle - see the NSBundle docs). You can then fetch them out, as needed, in code. For example, to fetch an image, use imageNamed:. To refer to a sound, refer to the file as a resource within the main bundle.
Other images are just saved in the app's disk space
That is a completely different matter. You will have to get the images from somewhere while the app runs. There is no way to have the user download the app and the image end up in the app's disk space: the app must populate its disk space, in real time, as the app runs. At the time the user downloads the app, the associated disk space, outside the app bundle itself, will be empty.
For images, see the responses to this question.
Sound is similar to images, but is loaded differently, this tutorial show how to load and play sounds.
For files that are saved after the app is installed, you will need to download and save those files in your code. For starters, see Apple's guide to the iOS file system

How to download and update local images under monotouch app

I have a question regarding how to update local images embedded as content in the application.
My application is built using 30 images stored as "Content" (embedded in the app) for a image gallery that I have to show. Every 2 days the application check server info to see if the images have been changed in the database, in that case then I have to compare files and if any file has changed then I have to download it and update the local image.
I have read the the best way to store images for this kind of porposses is under "Library" folder of the application, but the images that comes with the app are built as "Content" (embedded)...
Any clue on the best way to do that in monotouch?
Thanks.
Resources, like images, that you bundle inside your .app becomes part of your application. Since the application is signed you cannot update (or remove) those files as it would invalidate the signature (there's also file permissions that won't allow this to happen).
note: it can work in the iOS simulator since it does not require (or check) for application signatures, however it won't works for application on devices.
What you can do is:
Bundle default images with your applications;
Download new images (when needed) and install them outside your application (in the appropriate directory);
Have your application checks if there are downloaded images (or if images needs to be downloaded) and fallback to the images that ships with your application;
You can't change any file from your app (they're read-only).
What you can do is to save the files to a read-write directory, and at runtime check if those images are there (and not then use the ones bundled with the app).

Downloading and saving files with AIR for iOs

For a project we need to download and save pdf files on an IPAD device for offline use through an AIR for iOs application.
After a lot of searching I haven't found much information on this subject. My question is, can it be done, and if so, can you provide us with some pointers to lead us in the right direction.
Thanks for your time!
Sure, first you check if you can access the web - can use a class like air.net.URLMonitor, if you can you can set up a URLStream instance.
You get data while its downloading the file using the progress event, write that out to a File instance using the FileStream class.
To display the PDF file you can use a StageWebView or HTMLLoader.

Ipad DWG/DXF viewing

I have seen applications for iPad that let you view dxf and dwg files.
Does anyone know where to get info on how to do this? Are there any available tutorials? I haven't been able to find any.
I really need some direction on how to do this. The application I'm making just needs to show the files and layers.
Thanks for any help.
At present RealDwg is not available on iOS platform, so no way to view local dwg/dxf files.
But you have the other option. You create servers which open dwg files and send entities information in some format to your app, then your app can shows them. Through this way, your app can handle extremely large file. See AutoCAD WS.

Resources