Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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