views:

89

answers:

1

Hello,

I am creating a navigation based application, and throughout my application, I want to maintain an image as background. Also, I want parallax scrolling for the background, i.e., when I scroll table view cells vertically, background image should scroll at a relatively slower speed. Also, my application has some images and text in detail views, which should scroll at higher speed and background at a lower speed. This I want is to create a 3D effect. I have gone through cocos2D framework, but its all apps shows a single view and two images, one for foreground and one for background. So I need some starting point, whether I am in right direction or not. Also, is it possible without using cocos2D? Please help me for this.

Thanks in advance.

+2  A: 

Try to use the - (void)scrollViewDidScroll:(UIScrollView *)scrollView of UIScrollViewDelegate.
The table view is a sub-class of UIScrollView.

Michael Kessler
This will only inform you when the table view has finished scrolling - I assume he wants the background to move during the scroll as well?
deanWombourne
@deanWombourne, you are wrong. this method is called each time the scroll view moved (even during bouncing). So I still think that this might be a good solution...
Michael Kessler
Haha - I've just built a test app to prove you wrong and you're not! you're absolutely right - your answer will work perfectly :)
deanWombourne
:) You have some spare time, huh? ;)
Michael Kessler
I have a basic app set-up to check things like this - where I'm not 100% sure what the documentation means I can just quickly throw some code into the test app and see what happens - only takes about 5 minutes.
deanWombourne
Thanks for your replies, but my question is, I have set the background image for table view. But how can implement the parallax effect for scrolling?
Niraj
Implement the method that I've mentioned, take in account the content height of the table and the height of the image and move the image to the position that you need, according to the contentOffset of table's content...
Michael Kessler
Thanks Michael. I implemented the scrolling method, and animated my image with some calculations with contentOffset. It works perfect. Thanks a lot..
Niraj
@Niraj, if my answer solved your problem then you are more than welcome to mark it as accepted. Thank you.
Michael Kessler