iPhone SDK Zoom and refresh PDF with Quartz - iphone

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

Related

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.

iOS Problem when viewing PDF from Code

I need to show a PDF in my view and zoom and scroll it. I tried using the example from Apple. It works, but when I zoom in/out the image appears to be very pixelated and the result is very bad... can you help me avoiding the bad quality when I zoom ( when I finish to zoom, the pdf is shown right...)
Thanks in advance.
The zoom is implemented this way to reduce resource usage while zooming, because rendering a PDF page can be very resource intensive. During zooming a bitmap version of the page is used for display and when the zoom ends, the PDF page is rendered again. You could implement continuous page rendering during zooming but I'm afraid the result would be unusable.
Note that this does not really answer your question, but I don't think that the pixelation is a problem. The few milliseconds where the PDF is pixelated are not a big deal and will barely be noticed. The Apple apps do it like this too, I think - or at least they are not constantly updating the image/PDF.

Image with gestures - phonegap

I'm making an application who needs to display a map, contained in a large image file (png). The user must be able to zoom in/out the image and drag it in order to scroll the image with touch gestures.
I'm not sure that you get it, but i want to display a single image as it would be displayed by the "Photos" iphone application.
I would like some hints about the best way to do it with those gesture and with a navigation header in order to leave the image view.
Thanks in advance if you can give me any help about this issue because I did not find any clue on the phonegap doc.
/ouss
Why don't you use the built inn components for this?
Sounds like you need to wrap an ImageView inside a ScrollView and a HorizontalScrollView, then rescale the image by handling onTouch-events.
Take a look at the MapKitPlug plugin:
https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/MapKitPlug
Good Luck!
I would use http://cubiq.org/iscroll-4 which has some really slick image zoom going on. You can also start loading new images after certain zoom levels for finer grains of quality.
I would suggest Child Browser phonegap plugIn.
It is very simple and easy to implement.
It supports loading page from a url as well as you can show any kind of images.(png, jpg, jpeg, bmp and gif)

iPhone/iPad draw pdf like iBooks?

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.

Dynamic graphics rendering on the iPhone?

What I want to achieve is some way of supplying dynamically generated visual content that the user of a device could interact with - touch icons, text links, images etc embedded within some graphic image generated either on the phone or on a server. I would need, pinch, zoom, rotate functionality aswell.
Is it possible to render graphics dynamically within the iPhone's UI? So, for example, would it be feasible to supply an XML file to a device and have that render a custom map within the device? Would you have all the pinch-zoom, rotate and click on icons type functionality of a normal UI?
Alternatively, could I pre-render a png on a server and supply that to the device?
Any ideas or suggestions are appreciated.
Look into Quartz2D to help you do the custom drawing, it should do pretty much anything you want to do....
Sure, any of those are possible.
You'll probably need to write some code to interpret your XML file and generate an appropriate UIView and then embed that in the window.
And you're totally welcome to download images and display them in a UIImageView.