1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Scrollview overriding button touch

Discussion in 'iPhone/iPad Programming' started by mrl72, Jan 20, 2011.

  1. mrl72, Jan 20, 2011
    Last edited: Jan 20, 2011

    macrumors regular

    #1
    I have a weird issue where a button which is added as a subview of a scrollview, is reacting to touch events fine but in my buttonPressed:(id)sender method it's passing the tag of the main UIScrollView. I have a bunch of other buttons created in the exact same way (not in IB) and they work fine. Any ideas?

    Cheers.

    Edit: Nevermind, the button had a tag of zero changing this fixed the problem.
     
  2. Moderator

    robbieduncan

    Staff Member

    #2
    I'm happy that you found the solution to this. As an aside all controls have a tag of 0 unless you explicitly set them to something else. As such I'd avoid giving a tag of zero any meaning (i.e. if you want to know which control is the scroll view don't set the scroll view to 0).
     

Share This Page