1

i have a game with like 48 buttons that i have in a 6 x 8 grid. the games kind of like a chess game in the layout, so its kind of important to have all those buttons. well if you can imagine a chess game that the layouts so big that i may need a vertical scroll view so that the user can scroll up and down to play the game fully. And, when i scroll i obviously don't want my navigational buttons at the top scrolling too (menu button for example). So, what i did was i made a view controller, i added a UIView, then inside the UIView i added a scroll view, and inside that scroll view i added first all my 48 buttons for my chess-like game and then my bg for that game, so that the when the user vertically scrolled not only the bg would scroll but also all the buttons too. I did all the code and everything to make my scroll view work, and then lastly i put my navigational buttons (menu, pause etc..) inside my first view i made underneath the scroll view (so that it was layered correctly)


well, after i did this my scrolling worked fine, except there was a lag when i tried to press one of my 48 buttons. This was a lag that i did not experience before i put all my buttons inside a scroll view. Before this my buttons performed fantastically, but now that they were in a scroll view, they lagged a very little bit. Like when you touch the button it takes the button about a fifth of a second to change instead of instantaneous. Its a small lag, but definitely noticeable. Yet, when i try and touch my navigational buttons (that are not embedded in a scroll view) there is no lag at all,

Did i do anything wrong by putting my buttons in a scroll view? If so, what else can i do to get my buttons to scroll without my navigational buttons scrolling.

ANY HELP IS APPRECIATED!

EDIT: I'm running this on the simulator if that makes a difference

bmende
  • 741
  • 1
  • 11
  • 24
  • does it take long to call button handler or it just takes much time to render button press in ui? – Ivor Prebeg Jul 16 '12 at 17:46
  • its like you know when you press a button in fades a little right? (forgive my unknowledgable terms) , so usually when i press a button it fades instantaneous immediately, but for some reason my buttons are fading in like .2 seconds @IvorPrebeg – bmende Jul 16 '12 at 17:50
  • Do you have some weird layer shading or something? I did that once, took me 2 days to figure out... Did you try profiling with Instruments.app? – Ivor Prebeg Jul 16 '12 at 17:54

1 Answers1

2

I believe that this is something to do with responder, and the fact that both your UIButton and the UIScrollView need to know what to do with your touch.

If you put your finger on the UIButton, the UIScrollView will also see this touch. The UIScrollView is interested to know if this touch is going to turn into a drag, therefore waits to see if you move your finger. Perhaps this is blocking your UIButton from firing.

Alex
  • 8,801
  • 5
  • 27
  • 31
  • try this: http://stackoverflow.com/questions/3642547/uibutton-touch-is-delayed-when-in-uiscrollview – Alex Jul 16 '12 at 18:02