Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS

how do i scroll up in my app and as im scrolling to the top a sound file is played and gets louder more you scroll up

i would like to scroll up and down in my app and as im scrolling up i would like a sound file to play very lightly but the more you scroll to the top of the app the louder the sound get and when you scroll down the sound gets lower then eventually turns off.

Do i give the sound object a reference of point so when i scroll up the closer i get to the reference point the louder it gets. I dont know how to do this.

Please point me in the right direction to learn what i need to thanks.

You might need to add a observer on the Scrollview delegate...and then you can make calls to your audio file, and play with AVFoundation/AVPlayer. There's methods to see when the scrollview is scrolling:

https://developer.apple.com/reference/uikit/uiscrollviewdelegate