ios - UIButton stops UIScrollView scrolling in Swift -
my uiscrollview area scrolling except when user presses on 1 of buttons:
var button:uibutton = uibutton.buttonwithtype(uibuttontype.custom) uibutton button.frame = cgrectmake(0,0,self.width, self.menuheight) button.addtarget(self, action: "buttonclicked:", forcontrolevents: uicontrolevents.touchupinside) button.tag = int(itemno) scrollview.addsubview(button) and buttonclicked code:
func buttonclicked(sender:uibutton) { var tag = sender.tag println(tag) } it seems touchupinside method keeps control when user moves finder away button. best way of getting uiscrollview area scroll reliably?
try setting delayscontenttouches property of uiscrollview no.
also, can set cancancelcontenttouches property yes. (it's yes default, in case.)
reference (from docs) :
cancancelcontenttouches : boolean value controls whether touches in content view lead tracking.
delayscontenttouches : boolean value determines whether scroll view delays handling of touch-down gestures.
Comments
Post a Comment