ios - Adding gesture to UITextView cancels default behavior -


i wanted add single tap gesture uitextview when save dialog opened can cancel tapping uitextview. when cancels normal single tap behavior of textview. when single tap on text without save drawer out nothing. tap trigger callback method correctly cancels default action of uitextview, (to place cursor wherever tapped).

// add gesture cancel saving let singlecodetextviewtap = uitapgesturerecognizer(target: self, action: selector("codetextviewtapped")) singlecodetextviewtap.numberoftapsrequired = 1; codetextview.addgesturerecognizer(singlecodetextviewtap)  func codetextviewtapped() {     if savedrawerout {         movefilenamebanneroffscreen()         saveastextfield.text = ""     } } 

how can enable default behavior of uitextview while having single tap gesture?

edit
tried adding cancelstouchesinview = false , not seem work although seem correct answer. code looks this:

singlecodetextviewtap = uitapgesturerecognizer(target: self, action: selector("codetextviewtapped")) singlecodetextviewtap.numberoftapsrequired = 1 singlecodetextviewtap.cancelstouchesinview = false codetextview.addgesturerecognizer(singlecodetextviewtap) 

set delegate of singlecodetextviewtap view controller, implement gesturerecognizershouldbegin: , return false if savedrawerout true.


Comments

Popular posts from this blog

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -