Author Topic: Scroll view with items clickable  (Read 2371 times)

grebenots

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Scroll view with items clickable
« on: August 28, 2014, 07:00:49 AM »
I'm new to NGUI, so if this is common knowledge, I apologize.

I have a scrolling panel with say, 8 items.  I'm using iOS, and what I'd like to accomplish, is to be able to scroll the view when sliding my finger over the panel, but also be able to tap the individual items and have an effect (such as changing scene).

However, putting a button on the items, while still maintaining the ability to scroll the bar, triggers the button regardless of whether I'm actually tapping the item, or starting a drag on top of the button.

Is there functionality built into NGUI to accomplish this?

badawe

  • Jr. Member
  • **
  • Thank You
  • -Given: 8
  • -Receive: 7
  • Posts: 70
    • View Profile
Re: Scroll view with items clickable
« Reply #1 on: August 28, 2014, 11:34:48 AM »
you need to put UIDragScrollView in each buttons, and make sure your buttons use the OnClick method.

grebenots

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Scroll view with items clickable
« Reply #2 on: August 28, 2014, 11:52:59 AM »
That's what I have.  Swiping the buttons isn't the issue.  They move.  The issue is that I don't see a way to cause the OnClick event to only fire when it's an actual tap and not a drag.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scroll view with items clickable
« Reply #3 on: August 28, 2014, 09:25:58 PM »
You can cancel the click eligibility once the drag begins. Have a look at UICamera.currentTouch.clickNotification.