Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 05-27-2011, 08:48 AM   #1 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 34
Glyphs is on a distinguished road
Default Controlling the scroll in scroll views

Hi,

I have created an ebook app with a single scroll view and a single image view. When the user clicks the Next button, it displays the next image in the image view. You can scroll the image, then when you click Next, the next image's scroll is reset to (0,0). I do this by using the line: scrollView.contentOffset = CGPointMake(0, 0);

It works well, but with a little bug I can't seem to understand: If I wait for the scrolling to stop, then click Next, it works: the new image is reset to 0,0. But if I don't wait, then click next, the new image's position is the same as the previous one and the scrolling continues with the new image. Do you know a way around this?
Glyphs is offline   Reply With Quote
Old 05-27-2011, 09:18 AM   #2 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

seem that changing contentOffset during a scroll make some problems, maybe you can try to change the image on scrollViewDidEndDecelerating: so that when you change it the view is stopped.....just an idea, i don't know if can feet your needs.


However why you not use a uiscrollview paged with all the images? i think is more appropriate for a ebook....


ps: have you tried with
[yourScrollView setContentOffset:CGMakePoint(0,0) animated:NO];

just to be sure if animated:NO can help...
__________________

Last edited by dany_dev; 05-27-2011 at 09:21 AM.
dany_dev is offline   Reply With Quote
Old 05-27-2011, 09:54 AM   #3 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 34
Glyphs is on a distinguished road
Default

Quote:
Originally Posted by dany_dev View Post
ps: have you tried with
[yourScrollView setContentOffset:CGMakePoint(0,0) animated:NO];
Hey, it works!! Thanks!!

Quote:
Originally Posted by dany_dev View Post
However why you not use a uiscrollview paged with all the images? i think is more appropriate for a ebook....
I could, but I believe I would get the same results. I might try this for my next eBook though. Thanks for the tip.
Glyphs is offline   Reply With Quote
Old 05-27-2011, 10:20 AM   #4 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

nice....

however using the other approach give a better user experience that clicking a button (he can slide to change page)....
__________________
dany_dev is offline   Reply With Quote
Old 05-27-2011, 11:33 AM   #5 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 34
Glyphs is on a distinguished road
Default

Quote:
Originally Posted by dany_dev View Post
nice....

however using the other approach give a better user experience that clicking a button (he can slide to change page)....
I didn't know. Do you do this by stacking images of the same size and at the same position in the scrollview? I don't even know the code I should use for this. And what about memory? For this project, I have tried to load as less images at once as possible, which is why a single uiImage seemed convenient. Using a Back and Forward button seemed logical to me too. As a reader, I usually have less trouble clicking a Back and Forward button with my thumbs, than sliding a page. That said, I will definitely try this, at least as a test.
Glyphs is offline   Reply With Quote
Old 05-27-2011, 11:36 AM   #6 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

scrollview has a pagingEnabled property that you need to set
smithdale87 is offline   Reply With Quote
Old 05-27-2011, 12:06 PM   #7 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

Quote:
Originally Posted by Glyphs View Post
I didn't know. Do you do this by stacking images of the same size and at the same position in the scrollview? I don't even know the code I should use for this. And what about memory? For this project, I have tried to load as less images at once as possible, which is why a single uiImage seemed convenient. Using a Back and Forward button seemed logical to me too. As a reader, I usually have less trouble clicking a Back and Forward button with my thumbs, than sliding a page. That said, I will definitely try this, at least as a test.
basically you can see this example by apple: ScrollViewSuite
__________________
dany_dev is offline   Reply With Quote
Old 05-27-2011, 12:54 PM   #8 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 34
Glyphs is on a distinguished road
Default

Quote:
Originally Posted by dany_dev View Post
basically you can see this example by apple: ScrollViewSuite
Thanks! I'll have a look.
Glyphs is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 340
6 members and 334 guests
doffing81, dre, iOS.Lover, jenniead38, Kirkout, Wikiboo
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:13 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0