I'm new in iOS and I'm facing problem for Sign on a view.
I've created a view of Sign.As Shown in Image.
But when I added the view in the ScrollView I'm not able to Sign on it.So my Question is how to disable the scrollview on the view touch. I've used a code same as in this link How to draw Signature on UIView answer given by user3182143.
Thanks in advance
You should not add all your controls like
label
orview
or whatever directly on scrollview.You should add first
UIView
onscrollview
and on thatUIView
you should add your all labels or views like yoursignature view
.Second thing your constraint for your scrolview should be
top,bottom,leading,trailing
Constraints for
UIVIew - view in scrollview
-top,bottom,leading,trailing, fixed height and center x (horizontally in container)
- this is for vertical scroll view if you want horizontal scrolview then two constraint should be different -fixed width and center y
instead!Then you should add your
signature view
orlabel
on that view and you can set it's constraint like -top,leading,trailing,fixed height
or as per your need!So make sure that your setup match with the scenario that i have mentioned above!
You can implement
UITapGestureRecognizer
in your class and add action on your view to desable the scrollview.Hope this helps.
I tried with answer what you ask here.
I set scroll inside the view.Then I tried to write on the view but I could not do that.After that I hidden the scroll. Now it works.
SignatureDrawView.h
SignatureDrawView.m
What I added in above is just I created the post notification for stop the scroll when I touch to signature on view.It is implemented in start,moving and end method.
SignatureDrawView.m
Next in ViewController I created the scrollView and UIImageView with UIView.
ViewController.h
ViewController.m
In above viewDidLoad method I added addObserver for stop scrolling.
Finally I implemented the
stopScroll:
methodAlso I set the
scroll.scrollEnabled = YES
inactionSave
andactionclear
methodI gave you the solution only after I tried and worked out well.
Check and apply my code.It works fine and perfectly now.
Output Result