Support => NGUI 3 Support => Topic started by: Eze on July 31, 2014, 06:13:47 PM
Title: UIScrollView onDragFinished not working
Post by: Eze on July 31, 2014, 06:13:47 PM
Hi,
I'm trying to recieve an event from scroll view when it stops moving to get centeredObject from UICenterOnChild but onDragFinished is not getting called.
void OnEnable(){
scrollView.onDragFinished+= whichPageIsActive;
}
publicvoid whichPageIsActive(){
if(currentPage.centeredObject== page1){
Debug.Log("Page 1");
}elseif(currentPage.centeredObject== page2){
Debug.Log("Page 2");
}
}
When I replace onDragFinished with onDragStarted it works fine. What am I missing here?
Title: Re: UIScrollView onDragFinished not working
Post by: ArenMook on August 01, 2014, 08:05:27 PM
You should use "onStoppedMoving" instead. OnDragFinished is when you actually stop dragging -- it doesn't mean the movement has ceased.
Title: Re: UIScrollView onDragFinished not working
Post by: rxmarcus on October 17, 2014, 10:54:44 AM
I'm also having this issue, I have onDragFinished set to a function that simply prints a message to Console and it never gets called, so its not an issue of which one I should be using but that it just never gets called ever.
I am doing a zoom out and back in effect when the user starts drag and ends drag so I really do need to know when the drag ends rather then when movement stops.
Title: Re: UIScrollView onDragFinished not working
Post by: ArenMook on October 18, 2014, 08:48:24 AM
I'm guessing it's because you have UICenterOnChild there. I believe in the current Asset Store version of NGUI, it sets the callback rather than += appending it. Line 85 of UICenterOnChild. Change equals to +=. Same thing with the scroll bar callbacks directly below.
Title: Re: UIScrollView onDragFinished not working
Post by: rxmarcus on October 19, 2014, 08:57:08 PM