Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Sep 3, 2008, 07:23 AM   #1
Mac Me Up
macrumors regular
 
Join Date: Jun 2005
Location: Australia
Springy Bouncy scrolling of UIView

Ok, so I have a UIImageView in a UIView and I want them to be scrollable with my finger. I've made the image view multi touch capable and handled the
Code:
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
method. In this method I simple set the center of my view and image to the location that corresponds to how far it tells me that the users finger has moved. This works fine, and you can move it up and down with no problems.

My question is: how do I make this 'springy' and smooth like Apple's scrolling of tables, where your flick has momentum and the view springs when it hits the end. Is there an easy way to do this or do I have to write all the code that handles this?

At the moment my view moves to exactly where your finger stopped and no more, which feels unnatural on the iPhone.
Mac Me Up is offline   0 Reply With Quote
Old Sep 3, 2008, 07:31 AM   #2
dwm
macrumors newbie
 
Join Date: Jul 2007
Put your image view in a UIScrollView container/superview?
dwm is offline   0 Reply With Quote
Old Sep 3, 2008, 07:48 AM   #3
Mac Me Up
Thread Starter
macrumors regular
 
Join Date: Jun 2005
Location: Australia
Sorry to be a N00b, but I've put my view in a UIScrollView and made that view multi touch enabled, then commented out my implementation of the move method. Now it doesn't scroll. I've looked at the documentation for the UIScrollView and it seems like it should just work?
Mac Me Up is offline   0 Reply With Quote
Old Sep 3, 2008, 08:53 AM   #4
Mac Me Up
Thread Starter
macrumors regular
 
Join Date: Jun 2005
Location: Australia
Ok after smacking my head into a wall for a while I figured it out. I couldn't get it to work when I created the UIScrollView in Interface Builder, but as soon as I did it manually, hey presto!

Code:
scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 440)]
Mac Me Up is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Bouncy! trampoline. 2.0 update out now! monogames iPhone and iPod touch Apps 0 Apr 23, 2013 07:36 AM
Bouncy! New cute trampoline game monogames iPhone and iPod touch Apps 0 Jan 13, 2013 09:43 AM
bouncy Keyboard - keeps dismissing self. IDMah iPhone/iPad Programming 0 Jan 9, 2013 02:04 PM
Wobbly Bouncy Display - Normal ? (Video Clip) Halley1 MacBook Pro 8 Dec 18, 2012 08:25 AM
make uiview transparent without having the uiview's buttons transparent johnmerlino iPhone/iPad Programming 7 Jun 1, 2012 02:20 AM

Forum Jump

All times are GMT -5. The time now is 02:13 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC