Loading PDFs or Images from URL into a CoverFlow view - iphone

I want to load PDFs or Images into a View, but when the source is an URL there might be connection lags, so I wonder what is the best approach when loading content (like magazines) into a Coverflow view in the iPhone?.
(For Coverflow, something like this: http://apparentlogic.com/openflow/ )
Is it ok to get a pdf file then
obtain corresponding page images and
show them in an appropriate
resolution a Coverflow view?
(Downloading the hole PDF might take
long)
Or is better to download images as
needed and then pass them to the
Coverflow? (Although resolution
might be a problem, hence maybe I
wil need more than one image per
page)
Would it be better to have a pdf
file for every page?(So they can be
rendered at any resolution and I
don't have to download the hole file
at once)
I hope you can give some advices on this.
Thanks in advance.

Just for the record:
After some research I came up with images approach. They are the simpler, fastest, and reasonable good resolution. They can be loaded in 2 stages, regular resolution and better resolution for zooming, etc.

Related

Zoom high quality of the image to full detail without loading a large image on iPhone

I need to develop a feature into an iPhone app which will allow the user to zoom in very much on an image and display high-quality details of the image without loading the large and loading it online. I've found a example here: developer.apple.com/library/ios/#samplecode/ScrollViewSuite/ but it dont seems to zoom at full details,
And the images are store locally.
I have seem apple developer example like PhotoScroller, scrollviewsuite.
but feels they work differently just cutting the image in tiles.
Is it Possible To access asynchronously chunk of data and render it to view at same time in didReceivedData function delegate.
Please provide some tutorial or example.
Thanks
Avinash
Based on what you have said, PhotoScroller is really what you are describing. It is the only example that I know that can handle HUGE images and only display what is needed. I have used it for 100 megapixel images and it works great.

iphone best practice, how to load multiple high quality images

I have about 20-ish high quality images (~3840x5800 px) that I need to load in a simple gallery type app. The user clicks a button and the next image is loaded into the UIImageView.
I currently use [UIImage imageWithContentsOfFile:] which takes about 6 seconds to load each image in the simulator :(
if I use [UIImage imageNamed:] it takes even longer to load but caches the images which means its quicker if the user wishes to see the same images again. But it may cause memory problems later with all that caching crashing my app.
I want to know whats the best practice for loading these? I'm experimenting with reducing image file size as much as is possible but I really need them to be high quality image for the purpose of the app (zoomable, etc.).
Thanks for any advice
[EDIT]
Hey again guys,
Thanks for all ye're advice. The project's spec's have changed a little. Now as well as displaying the images they firstly have to be zoomed in to a particular spot and when the user taps next it zooms out and then displays the next image. So I'm not sure if the proposed solutions fits?
Apple's docs recommend against trying to load single images that are larger than 1024x1024. You should look into using CATiledLayer instead, to load pieces of the images as needed.
You can have a look at this Apple sample:
http://developer.apple.com/library/ios/#samplecode/PhotoScroller/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010080
It shows how to load big images, breaking them in tiles for different zoom levels.
You can't see all those pixels at any given time, so there is no need to load them all. Load lower-res copies ("big-thumbnails") to view the complete image, then selected sub-tiles, maybe of 2 or more different resolution sets, after the user zooms in.
The CATiledLayer API may be able to handle some of the latter for you.

Loading a 20MB png in a UIImageView embedded in a UIScrollView

I have a large png Image that I need to Zoom&Move.
I therefore created a UIScrollView and embedded a UIImageView.
The App works fine in the simulator, but when running it on the device (8GB iPod Touch) it crashes as soon as the view is loaded.
I tried with a smaller test Image (4MB) works fine and suspect the iPod can't handle a 20MB PNG. I also tried different other formats, such as JPG (in various save patterns), but that did't help either.
Any clues how I can solve this?
Ouch, 20M is a large image. The first thought that comes to mind is can you dice up the image? I.e. instead of one image have a whole bunch of small images which together make up the larger image. Then you can load on demand the same way google maps downloads image squares.
have a look at the ScrollViewSuite Example from apple. Sounds exactly like what you are trying to do.
3_Tiling demonstrates:
How to subclass UIScrollView to add content tiling
Reusing tiles to optimize performance and memory use
Changing the resolution of the content in response to zooming
I suggest the Example Photoscroller. It demonstrates CATiledLayer which you can use to tile your image and even use smaller images as lod images. It's much smaller then the complete ScrollViewSuite example but has everything you need to do what you want. It contains only 2 classes which you should be able to use in your project with minor edits.
You might want to check the WWDC 2010 Session #104 "Desinging Apps with Scroll Views"... they handle and explain that example.
You will need to tile your image. I suggest imagemagick for that :)

Is there a View Controller to show thumbnails like the Photos app?

I am looking to replicate the image gallery view that shows thumbnails, like in the photos app on the iPhone.
Is there a view controller or any examples that anyone can provide to replicate this?
There isn't one provided by Apple. I would recommend looking at Three20. It has a few things with look a lot like the Photos app.
Another option is AQGridView.
Take a look at the video of Session 104 from the WWDC 2010. It's basically a 40 minute tutorial on how to do the photo app.
Bear in mind that allowing users to zoom will greatly increase the space required. If you use CATiledLayers, that is, which, depending on your desired zoom level, you should consider doing.
Oh, and there is source code ;)
What they don't tell you is how they did their tiling. I found that you can
a) download ready-made tiles from the server with the app or with a content update (you can use ImageMagick's crop tileWidthXtileHeight - e.g. crop 100x100 - to do the tiling). This has the disadvantage of large downloads.
b) download ready-made tiles from the server as needed (may lead to lags in your app, but then MKMapView does it quite nicely, doesn't it?)
c) tile on the phone as needed (here you can also consider caching the results, although that will likely mean you have to check space left on the device)
I've recently given enormego's PhotoViewer a try. It's easy to use, and it's much more focused than the Three20 project. (Which I also use and like a lot.)

Problems with images on iPhone

In my application I use lots of images based in interface builder. The problem with this is that it uses large amounts of memory because interface builder caches it much liked "imageNamed" so I've begun removing the image from imageViews in interface builder and instead adding them once the view starts using "imageWithContentsOfFile". After several hours I have made little progress because I have literally hundreds of images. I'm just wondering if there is a more straightforward way to do this?
Yes, don't do it. UIImage and the whole xib business pretty much delay loading until things are needed, as well as drop cached images where possible and needed. You can even see this happening in Instruments. It helps to split your design over several xibs, so they can be loaded when needed.
What you can do however, is to make sure that you don't scale images but display them 1:1, and that you save them in the lowest acceptable quality. For photo's, take JPEG. For other images, take PNG.