0

I'm trying to make the background and text change as the user scrolls up or down. Similar to what Apple uses on their website pages like this http://www.apple.com/iphone/why-theres-iphone/

How can I do this effect?

Ricky Wooz
  • 11
  • 1

2 Answers2

1

It's not THAT easy to do this, unfortunately.

in the first instance, you must learn about gestures in iOS.

UISwipeGestureRecognizer

Your question is of an extremely general nature, and there are 1000s of immediately accessible easy tutorials on using UISwipeGestureRecognizer so you should work through those.

Secondly you have the general concept of "sliding pages around" in iOS.

sliders

It rather depends on precisely what you are trying to achieve, but this for example would be a good first step for you to implement while you are learning about these basic concepts:

sliding screens tutorial on iOS

Community
  • 1
  • 1
Fattie
  • 27,874
  • 70
  • 431
  • 719
0

If you are to change UIView background in scroll up/down, you first need "UIScrollView" to be added in the main UIView of the ViewController. Then you should use the UIScrollView delegate method:

func scrollViewDidScroll(scrollView: UIScrollView) {
    if (scrollView == yourScrollView) {
       //change background according to the scrollview content offset.
       if(scrollView.contentOffset.y > some_value && scrollView.contentOffset.y < some value) {
        scrollView.backgroundImage = your_image
        }
    }
}

Before using you should conform the delegate "UIScrollViewDelegate".

Kusal Shrestha
  • 1,643
  • 2
  • 13
  • 20