views:

36

answers:

2

Hey folks,

i need a little push to the right direction i think.

What i want to do is displaying pages of a brochure at the iPad Display and allow the user to flip through the pages (left to right & right to left). The user should also be able to zoom in to articles at the pages.

I tried it with laying an UIImage into a UIImageView and then this UIImageView to a ScrollView. This works only if i have one Page. The second page is not displayed.

What would be the best way to do this ?

Greetings

MadMax

A: 

Set your scrollview pagingEnabled property to true, then set the contentSize to a size thats the sum of widths of all the imageviews. You then add each UIImageView to the UIScrollView making sure to position them next to each other.

Here is a tutorial talking about this: http://kwigbo.com/post/758575763/uiscrollview-image-gallery-tutorial

I'm not sure about enabling zoom but that should get you paging through image views.

Ben
This is very close to what i need to to, but the app crashes on the device. I think it's because of the size of the Images. 12 Pages (12 Pictures) each around 650 kb size. The Images need to be large, the user should be able to zoom to an article on a page to read it. Any suggestions ? Maybe using initWithData instead of imageWithName?
MadMaxAPP
What you can do is swap the images in and out of memory, so keep a minimum of 3 imageviews in the scrollview then load and unload images when swiped. Or you can compress the images more. That doesn't seem like a lot of memory though it should be fine.
Ben
Thats what the Debug Console says:Program received signal: “0”.Data Formatters temporarily unavailable, will re-try after a 'continue'. (Unknown error loading shared library "/Developer/usr/lib/libXcodeDebuggerSupport.dylib")
MadMaxAPP
That sounds like something other than a memory issue.
Ben
You mean releasing the not needed imageviews and adding them later when needed again?
MadMaxAPP
Well releasing the image part of them at least, but I don't think memory is your problem anymore.
Ben
Actually I take that back it does seem like memory. Try using the 3 imageviews and assigning images to them as needed.
Ben
wow... made the changes and now the app crashes after 4 wipes... 3 Memory Warnings and then is crashes. Need to investigate that further...
MadMaxAPP
If you are using IUImage imagenamed: you may want to switch to alloc initWithContentsOfFile so you can manually release the images and not rely on an autorelease.
Ben
ok ... i found out the Images used where in 150dpi. After changing it to 72dpi i only recieve sometimes a memory warning. I will change that to initwithContentsOfFile.
MadMaxAPP
A: 

I can't get the zooming to work ... any Idea ? Ben ? Still there :-) ?? If i activate the zooming, both Images where zoomed at the same time and overlap. After the zooming, the scrolling does not work anymore.

I included the

viewForZoomingInScrollView

but i can't figure out how to wire things up.

MadMaxAPP