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 Tutorials

Reply
 
LinkBack Thread Tools Display Modes
Old 09-04-2008, 10:06 AM   #1 (permalink)
Tutorial Author
 
Join Date: May 2008
Posts: 315
myersn024 is an unknown quantity at this point
Default UIScrollView Tutorial

This is a simple tutorial on how to add a UIScrollView to your project.

Unfortunately, the embedded versions of these videos from vimeo.com aren't in HiDef. To see them in HiDef, you'll either have to view them at vimeo.com or you can download a HiDef version to your computer with the link below (about a 40 meg download). It probably bears stating that I am in no way affiliated with vimeo.com. One of the forum members here suggested them for video hosting, and I've been pleased with their service thus far. If anyone has a better suggestion, I'm all ears.


iPhone Tutorial - UIScrollViews with pinch/zooming from Nick Myers on Vimeo.
Download the HiDef version to your computer
myersn024 is offline   Reply With Quote
Old 09-05-2008, 07:21 AM   #2 (permalink)
New Member
 
Join Date: Apr 2008
Location: Germany
Posts: 154
ChriB is an unknown quantity at this point
Default

Thank you, great work!
ChriB is offline   Reply With Quote
Old 09-05-2008, 10:04 AM   #3 (permalink)
Registered Member
 
Piruz's Avatar
 
Join Date: Sep 2008
Location: France
Posts: 49
Piruz is on a distinguished road
Default

Thanks you for this tutorial

But I have a request : anyone could help me to have the scrollview centered on the screen when I zoom out ? I tried all the day, but I think I'm not enough used to this langage to find a solution
Thanks by advance
Piruz is offline   Reply With Quote
Old 09-07-2008, 08:55 AM   #4 (permalink)
New Member
 
Join Date: Sep 2008
Posts: 23
EricCartman is on a distinguished road
Default

Hi, very nice tutorial. However, when I build and install this application onto the iphone. The pinching and zooming events are not always registered. The pinching gesture are sometimes registered as just tabs, any idea why?

Thanks
EricCartman is offline   Reply With Quote
Old 09-07-2008, 02:16 PM   #5 (permalink)
Tutorial Author
 
Join Date: May 2008
Posts: 315
myersn024 is an unknown quantity at this point
Default

I haven't installed this app to my phone to try it out. I'll do that a little later and see if I have the same problems.
myersn024 is offline   Reply With Quote
Old 09-07-2008, 02:40 PM   #6 (permalink)
New Member
 
Join Date: Sep 2008
Posts: 23
EricCartman is on a distinguished road
Default

Quote:
Originally Posted by myersn024 View Post
I haven't installed this app to my phone to try it out. I'll do that a little later and see if I have the same problems.
Thanks for the reply. I have another question.

I have been trying to add the scroll view to a view controller class. I added the UIScrollViewDelegate to the definition of the view controller class, and assigned the scrollView's delegate to self (the view controller), and finally added
-(UIView *)viewForZoomingInScrollViewUIScrollView *)scrollView{
return myImage;
}
in the view controller implementation.

Everything compiles fine. However, when I run it, the image is loaded into the scrollview, but it does not respond to any touch events (no panning, pinching etc..) Any suggestions?

Thanks
EricCartman is offline   Reply With Quote
Old 09-07-2008, 09:31 PM   #7 (permalink)
Tutorial Author
 
Join Date: May 2008
Posts: 315
myersn024 is an unknown quantity at this point
Default

I don't have a clue about the second problem you're having. My advice is to make sure that you have everything set up properly. I've compiled and ran the sample code that I provided with the tutorial, and I'm having the same problem that you are with the multi-touch zooming not always registering properly. I'm going to have to play around with it some more to figure out what's wrong there. Unfortunately, I didn't test the code on my testing device before posting the tutorial.....however, I'm sure that the fix is rather simple. If anyone out there can shed some light on this, I'd really appreciate it.
myersn024 is offline   Reply With Quote
Old 09-11-2008, 09:06 AM   #8 (permalink)
New Member
 
Join Date: Sep 2008
Posts: 23
EricCartman is on a distinguished road
Default

Quote:
Originally Posted by myersn024 View Post
I've compiled and ran the sample code that I provided with the tutorial, and I'm having the same problem that you are with the multi-touch zooming not always registering properly. I'm going to have to play around with it some more to figure out what's wrong there. Unfortunately, I didn't test the code on my testing device before posting the tutorial.....however, I'm sure that the fix is rather simple. If anyone out there can shed some light on this, I'd really appreciate it.
Does any one have any insight on this issue?

Thanks
EricCartman is offline   Reply With Quote
Old 09-17-2008, 06:17 PM   #9 (permalink)
Senior Member
 
MaCeXpErTo's Avatar
 
Join Date: Jul 2008
Posts: 149
MaCeXpErTo is on a distinguished road
Default

Is there anyway to make this scroll just vertically and not horizontally?
__________________
"I love this place"
MaCeXpErTo is offline   Reply With Quote
Old 09-19-2008, 09:11 AM   #10 (permalink)
Tutorial Author
 
Join Date: May 2008
Posts: 315
myersn024 is an unknown quantity at this point
Default

I'm pretty sure that you can lock the horizontal direction, but I haven't implemented it. Eventually, once I get caught up with school and work, I'll get back to this tutorial and answer some of the questions that people are asking........it's amazing how life gets in the way sometimes!
myersn024 is offline   Reply With Quote
Old 09-19-2008, 03:05 PM   #11 (permalink)
Senior Member
 
MaCeXpErTo's Avatar
 
Join Date: Jul 2008
Posts: 149
MaCeXpErTo is on a distinguished road
Default

Quote:
Originally Posted by myersn024 View Post
I'm pretty sure that you can lock the horizontal direction, but I haven't implemented it. Eventually, once I get caught up with school and work, I'll get back to this tutorial and answer some of the questions that people are asking........it's amazing how life gets in the way sometimes!
Oh, I hear ya man... I been having no time lately... So much college work
__________________
"I love this place"
MaCeXpErTo is offline   Reply With Quote
Old 09-19-2008, 06:49 PM   #12 (permalink)
Tutorial Author
 
Join Date: May 2008
Posts: 315
myersn024 is an unknown quantity at this point
Default

Quote:
Originally Posted by MaCeXpErTo View Post
Oh, I hear ya man... I been having no time lately... So much college work
Tell me about it. I've got a full-blown project for an object-oriented programming class that I haven't even started and I've been promising that an update to To Do's will be out the first week of October. WHAT WAS I THINKING???!!!!

I'll be lucky to get anything finished in the next two or three weeks.....way too much going on and not enough time in the day! Oh well
myersn024 is offline   Reply With Quote
Old 11-20-2008, 12:46 AM   #13 (permalink)
hemali
 
Join Date: Nov 2008
Location: Ahmedabad
Age: 25
Posts: 12
hemalimojidra is on a distinguished road
Default UIScrollView Idea

Thnk you...It work..
You can also take idea from....
iPhone Dev Center
hemalimojidra is offline   Reply With Quote
Old 12-06-2008, 08:20 AM   #14 (permalink)
Tutorial Author
 
Join Date: Nov 2008
Posts: 136
elpuerco is on a distinguished road
Default

I understand the tutorial and can replicate it with ease, but I cannot figure out how to have the code work so it is not all in the app delegate code?

For example I want to have this code work in another view?

Create a new project called test and you get the app delegate .h and .m files as well as the testviewcontroller .h and .m files.

I am trying to get the scrollview to appear in the testviewcontroller files xib etc

but all the referencing in the tut is in the delegates code?

Any pointers?

Thanks
elpuerco is offline   Reply With Quote
Old 06-12-2009, 12:50 PM   #15 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 140
jbullfrog is on a distinguished road
Default Adding a view to a scroll view?

Hello, im new to the forum and have a question about your scrollview tut. Can I just add a view to the scrollview, and have that view contain UIImages, and UIButtons? I think the answer is yes, but im having trouble getting things to work.

Can I place the scrollview in my xib and the view and its contents into the scrollview in that same xib?

Thanks
jbullfrog is offline   Reply With Quote
Old 09-19-2009, 03:39 AM   #16 (permalink)
Banned
 
Join Date: Sep 2009
Posts: 25
Iphone14 is on a distinguished road
Default

Hey Guys,

I'm having the same problem as elpuerco!

Any help would be greatly appreciated!

Thanks
Iphone14 is offline   Reply With Quote
Old 10-24-2009, 12:41 PM   #17 (permalink)
Registered Member
 
Join Date: Oct 2009
Posts: 3
bobcubsfan is on a distinguished road
Default Repeated images

Great tutorial. Thanks.

In using the scrollview and getting different images, the images are "building up" so the scrollview is showing multiple images when the top image is pinched, zoomed and moved around.

How can I clean it out so there is only one image in the view?
bobcubsfan is offline   Reply With Quote
Old 10-25-2009, 10:27 AM   #18 (permalink)
Registered Member
 
Join Date: Oct 2009
Posts: 3
bobcubsfan is on a distinguished road
Default Try this

Quote:
Originally Posted by elpuerco View Post
I understand the tutorial and can replicate it with ease, but I cannot figure out how to have the code work so it is not all in the app delegate code?

For example I want to have this code work in another view?

Create a new project called test and you get the app delegate .h and .m files as well as the testviewcontroller .h and .m files.

I am trying to get the scrollview to appear in the testviewcontroller files xib etc

but all the referencing in the tut is in the delegates code?

Any pointers?

Thanks
-(void)scroller
{
//this gets an image from an SQLITE db

[self getBillPic];

initWithImage:billImage];
self.myImage = [[UIImageView alloc] initWithImage:billImage];



myScrollView.contentSize = CGSizeMake(myImage.frame.size.width, myImage.frame.size.height);
myScrollView.maximumZoomScale = 4.0;
myScrollView.minimumZoomScale = 0.75;
myScrollView.clipsToBounds = YES;
myScrollView.delegate = self;
[myScrollView addSubview:myImage];
}
- (UIView *)viewForZoomingInScrollViewUIScrollView *)scrollView {
return myImage;
}

I placed this code in a ViewController. The UIScrollView in a XIB file
bobcubsfan is offline   Reply With Quote
Old 11-14-2010, 04:56 PM   #19 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 6
mywa11 is on a distinguished road
Default

it is interesting, but i have a question
how can i dynamic cahnge image?
for example i have a chess board, and user can add figures to the board
how to make such application in this case? i can not just have an image of board, i have to change it every turn
mywa11 is offline   Reply With Quote
Old 02-01-2011, 04:47 PM   #20 (permalink)
Registered Member
 
Join Date: Jan 2011
Posts: 6
communati0n is on a distinguished road
Default

wow thx cleared up a lot of issues
EDIT: one issue tho, how do i put a scrollview into a viewcontroller?

Last edited by communati0n; 02-01-2011 at 05:24 PM.
communati0n is offline   Reply With Quote
Old 02-06-2011, 09:36 AM   #21 (permalink)
Registered Member
 
Join Date: Sep 2010
Location: Berlin
Posts: 3
Helena158 is on a distinguished road
Default

Great tutorial, thanks for your work
Helena158 is offline   Reply With Quote
Old 04-04-2011, 02:21 PM   #22 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 3
kshitija is on a distinguished road
Default

Hi

I am developing an application which has buttons to navigate through the various views. My 1st view is a Registration page which has a ScrollView. On clicking the next button on this page, the next view is displayed. On clicking the Back button in this page the previous view is displayed but you can no longer Scroll as earlier.

Could anyone tell me why is it so?
kshitija is offline   Reply With Quote
Old 10-07-2011, 01:17 AM   #23 (permalink)
Registered Member
 
Join Date: Sep 2011
Posts: 1
greatman1612 is on a distinguished road
Default Help me!!!

Anyone help me reason my applications don't debug. Download Code

Thanks a lot!
greatman1612 is offline   Reply With Quote
Old 12-17-2011, 05:05 PM   #24 (permalink)
Registered Member
 
Join Date: Dec 2011
Posts: 1
HighExistance is on a distinguished road
Default

This doesn't help me.. I'm still having issues. Can someone please post a video or instructions on how id do this in Xcode 4.2 and with adding a picture under resources not the way its done here. Ive been trying the last 3 days to get a pinch zoom working for a photo..
Thanks!!
HighExistance is offline   Reply With Quote
Old 12-17-2011, 09:38 PM   #25 (permalink)
Registered Member
 
Join Date: Dec 2011
Posts: 1
sevenstars is on a distinguished road
Lightbulb Please help me!!!!

How to play pdf on website with Ipad?

Quote:
Originally Posted by myersn024 View Post
This is a simple tutorial on how to add a UIScrollView to your project.

Unfortunately, the embedded versions of these videos from vimeo.com aren't in HiDef. To see them in HiDef, you'll either have to view them at vimeo.com or you can download a HiDef version to your computer with the link below (about a 40 meg download). It probably bears stating that I am in no way affiliated with vimeo.com. One of the forum members here suggested them for video hosting, and I've been pleased with their service thus far. If anyone has a better suggestion, I'm all ears.


iPhone Tutorial - UIScrollViews with pinch/zooming from Nick Myers on Vimeo.
Download the HiDef version to your computer
sevenstars 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 On
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 458
15 members and 443 guests
alexeir, David-T, Dj_kades, foslock, HemiMG, iAppDeveloper, jeroenkeij, LunarMoon, Mijator, Pauluz85, pipposanta, QuantumDoja, robsmy, sacha1996, usernametaken
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,679
Threads: 94,129
Posts: 402,928
Top Poster: BrianSlick (7,990)
Welcome to our newest member, xzoonxoom
Powered by vBadvanced CMPS v3.1.0

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