iPhone/iPad draw pdf like iBooks? - iphone

Does anyone know how to use core graphics to draw a pdf like in iBooks. I can already draw a pdf page using core graphics but was curious how iBooks shows a lower quality view of each page so it loads fast and then when you stay on a page longer it renders it a full quality. This makes it able to open the pdf without having to make the user wait like most magazine apps you see on ipad. Any ideas would help!

Apple have some "ZoomingPDFViewer" sample code:
http://developer.apple.com/library/ios/#samplecode/ZoomingPDFViewer/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010281
I suspect that might give you some good ideas :-)

I assume they use multiple layers, the first layer loads the pdf in low resolution and the better resolution is prepared in the background. When ready these layers are swapped.
Have a look at CGPDFDocumentRef and CATiledLayer in the documentation.

Related

Create iphone interface from psd

For every developer arrives the day to improve the user interface experience because apps are evalutated mainly from the ui carefulness.
So, i've took a look around the websites and I found some psd where to start to desing my apps.
My question is: How to transform a psd prototype to a well-working app?
I don't unserstand how a mockup can help a developer to build a ui...
Can someone make me some clear the situation?
Well, I'd be careful to make a distinction between the graphics an app uses and the actual User Interface. Certainly the graphics are part of the UI, but the UI is soooo much more than that. Depending on how it is done, photoshop mock ups can be simple graphics you can use for your interface to complexes 'scenes' describing how the app functions. In the latter case, the mock-up can be useful for UI design, in the former case it just gives you pretty images to use (which can certainly be useful).
But to more directly answer your question, most people take 'slices' (individual pieces) of the photoshop image and export them as .png images (or .jpg). If the .psd file doesn't already have the images 'sliced', look up 'photoshop image slicing' on Google. You can then import them into Xcode and use them as background images for the controls you want to use. Especially since iOS 5.0, images can be used for a lot of controls. Also, you'll probably want to make sure you make the image resizable with proper UIEdgeInsets. This will allow the image to resize without pixilation by setting an area that can be tiled within the image.

Huge image I want to manipulate in my Xcode app

I have a huge map image (25mb) that I want to use in my app. The entire point of the app is to pinch zoom and scroll around this richly detailed map.
I am loading it in a uiimageview, with some subview layers that can be toggled on and off to overlay the map.
Everything is working fine code wise and on my simulator, but my concern is that the actual iPhone/iPad may have problems rendering/manipulating a 25mb png image.
Anyone have experience with huge image files in Xcode? Any recommendations or concerns about what I have described?
Someone suggested using uiwebview to display the image. I'm not sure why thy would be any better.
Thanks
Best way to handle very large images is to chop them into easily manageable square chunks and load them dynamically. Here you can see a very nice tutorial for a tiled UIScrollView. Modding the code a bit will surely suit your needs.
Check out the ADC Videos, specifically WWDC 2010 Session 104 "Designing Apps With Scroll Views". This shows how to use CATiledLayer.

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 4 - How do I record the video overlay on top of the video also?

Does anyone know how to do this?
Is anyone able to provide an example? I believe this is out of NDA now as was available in version 4.0 ?
Take a look to AVFoundation framework , specially to avcapture avsession avinputdevice, etc. You can find some listings in the iPhone dev center forums: search "avcapture"
AVFoundation is the framework you want to use to record, modify raw frames, show them, an offcourse add some overlay
If you want to do only overlay then, UIImagePickerController should b enough.
If i understand, what you are trying to do corectly, you have set up video capture someting like suggested by Apple in this Q&A:http://developer.apple.com/iphone/library/qa/qa2010/qa1702.html
From there it shouldn't be much of a Problem to use the method described in this answer:blend two uiimages based on alpha/transparency of top image to blend the preview with your overlay, provided you draw it in a UIImage first. Feed the resulting images to a buffer and save it accordingly.
Though, this method most certainly wouldn't give you a lot of frames per second.

iPhone SDK Zoom and refresh PDF with Quartz

Looking at the QuartzDemo sample application, I love the speed of the PDF rending using quartz alone (that is, without using uiwebview). However, when I'm zooming in the PDF it doesn't seem to become more clear like it does in PDF view.
Is there something that I can change to have the same effect when zooming in and out using multitouch? like manipulate the PDF transformation matrix or something?
Thanks a bunch.
--Ben
To make it zoom, and more clear,
You can use CATiledLayer. You can see the following example.
http://www.olivetoast.com/blog/hamish/simple_uiscrollview_catiledlayer_example.ot