swift - Dragging UITextView Around Screen -
i'm trying allow user draw uitextview around screen in snapchat app. tried code below doesn't seem work. suggestions? don't thin detectpan method being called. have override uitextfielddelegate property?
var panrecognizer = uipangesturerecognizer(target:self, action:"detectpan:") text.addgesturerecognizer(panrecognizer) func detectpan(sender:uipangesturerecognizer) { self.view.bringsubviewtofront(sender.view!) var translation = sender.translationinview(self.view) sender.view!.center = cgpointmake(sender.view!.center.x + translation.x, sender.view!.center.y + translation.y) sender.settranslation(cgpointzero, inview: self.view) }
not sure if efficient way go put textview in view , disabled user interactions. made tap gesture (which makes textview first responder) , pan gesture (which moves view).
Comments
Post a Comment