UIButtons delayed response

I sideloaded an app I made to my iPhone. All the buttons are set to "Touch Down" so supposedly they should respond the moment my finger touches them. But, some of the buttons don't always immeditely respond to my tap, it takes a few seconds for them to react.


Also, this issue only occurs when I run the app on my iPhone, the buttons work perfectly in the simulator.

Anyone know how to fix this?

Accepted Reply

This thread has been deleted

Oh never mind!! I figured out the problem!! I was having issues with some of the buttons at the top and the bottom of the screen they are so small and they are so close to the edges that when I touch them I always accidentally touch the edges first, and that caused my buttons to be unresponsive sometimes!!

Replies

Your code asks for the sound file each time the button is hit. The device needs to load it into memory, then play it. Depending on the device/hardware, and the size of the sound file, there can be a delay before the audio is played.


If the sim doesn't complain about your code in general, I suspect it's a timing/performance issue.


How may sound files are you using, and what is their average size in MB?


Which version Xcode are you using?


Otherwise, rather than sideload, just use Xcode to run....suggest you then use Instruments to see where the delay might be happening. Use the "Time Profiler" Instrument to see what code is taking the most amount of time. See: https://developer.apple.com/videos/play/wwdc2016/418/


Post the summarized results if you need help understanding what's going on, etc.

Post not yet marked as solved Up vote reply of KMT Down vote reply of KMT