ios - Cant move UIScrollView that has buttons in it when pressing and dragging the buttons -


i have uiscrollview has buttons inside , when i'm trying press button , sliding side uiscrollview doesn't move when i'm sliding fast move. i'm using uicontroleventtouchupinside on button. code i'm using add buttons scroll view:

-(void) setscrollview:(int) numberofviews {     (int = 0; < numberofviews; i++) {         cgfloat xorigin = * 40; uibutton *button = [uibutton buttonwithtype:uibuttontypecustom];         [button addtarget:self                    action:@selector(scrollviewbuttonclicked:)          forcontrolevents:uicontroleventtouchupinside];         [button settitle:[nsstring stringwithformat:@"%d",i] forstate:uicontrolstatenormal];         button.frame = cgrectmake(xorigin, 0, 40, 40);         button.tag = 1000+i;         button.backgroundcolor = [self getcolorforsound:self.sounds[i]];         [button setexclusivetouch:yes];         [self.soundsscrollview addsubview:button]; } } 

how can make uiscrollview scroll if user pressed button , tries scroll?

this design. conceptually, 1 view should processing touch event. when touch button, button related processing handled (e.g., button press). touch event cannot processed both button , scroll view @ same time. once start touch event in button, button "owns" touch , scroll view doesn't process it.

the reason why when slide "really fast" scroll view move because scroll view gets inspect touch event first since parent view of buttons. if touch event isn't "moving", pass along subviews, in case buttons, see if can process it. however, if scroll view detects touch moving before button has chance process touch event, scroll view take ownership of touch event , process scrolling.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -