I am drawing the line on touch using "UIBezierPath" UIBezierPath.
I want to implement the UNDO feature in which when user press on UNDO button then last drawn line should be removed from the screen.
How can i do this? I have used "removeAllPoints" function of "UIBezierPath" but it doesn't work.
Related
I write this link's answer code to create ImageViewLayer and Imageview.
StackOverflow Link
This link gives me the below result.
It's work fine .But I want ,when user press the original button... and then touches with finger it remove the clear area ang fill with the previous one.
And how to create Undo Functionality for this..If any question regarding this please add your comment..Please help me...
how to draw CALayer with line path like simulate eraser effect?
this is the post i get the answer. there is a sample code about the effect.
what you are different is change the gray color layer to be the "paper imager"
hope it help you
I'll make this as simple as I can.
I have a UIView in the shape of a balloon that floats around its original center. I want to add a line (to look as the rope) and I want it to be linked with its animation, as it turns out, drawing a line isn't as simple as adding a UIView, and the UIview doesn't include the line in it, it's a View Controller containing both.
How can I link both of them so that when the Balloon animates to a different position, the line end that touches the balloon animates with it?
Looks like the only way I could find around this was through NSNotification Center.
In Xcode 5, I am trying to make an app that allows the user to draw a line based on touch. I would have this working using UIBezierpath but then I am not able to remove the last line once the user tries to draw a new one. What method would I use to draw a line between touchDown and touchUp that can be easily deleted? Thanks in advance!
The easiest way is to use the UIBezierPath to construct a path which you then assign to a CAShapeLayer. You then add that layer as a sublayer to some view you already have in the interface. To delete the line, remove the layer.
I am trying to achieve the following in xcode: One a pan gesture has reached a certain point, I want to draw a draggable item, and have the user's finger automatically keep dragging it around to move the new item. Everything works, except for one problem: The finger needs to be picked up and put down again on the new item when it is initially drawn (I assume to trigger touchesbegan).
Does anyone know if there is a way to force start touchesbegan if the finger is already pressed when the newly drawn item is first rendered (so the user doesn't have to pick up and put down his finger)?
One of the functions of program is to select a piece of the map. I do this using MKAnnotations and using a MKPolygonView (with just the border visible) to connect the "dots". (Please take a look at the screenshot below).
However, I'm trying to find a mechanism so that users can add new pins. This should be done by pressing on a border part of the MKPolygonView and then a new pin is added in the middle of the border.
In order to do this, I have to intercept touches, probably using the UIGestureRecognizer. I have looked at Touch events on MKMapView's overlays, which gave me a good lead. The only problem is that this intercepts touches also inside the MKPolygonView. I just need the border.
Is there any way to achieve this kind of behavior?
This is an old question, but anyway - one of the possible workarounds is using MKPolyline simultaneously. You could add a MKPolyline, matching MKPolygon border and detect taps on MKPolyline.