public override void TouchesBegan(NSSet touches, UIEvent evt) { base.TouchesBegan(touches, evt); var touch = (UITouch)touches.AnyObject; var point = touch.LocationInView(touch.View); var path = new CustomUIBezierPath(); if (LineWidth <= 0) { path.LineWidth = 5; } else { path.LineWidth = LineWidth; } path.LineColor = LineColor; path.MoveTo(point); _paths.Add(path); }
public void Clean() { _paths.RemoveAllObjects(); if (NeedBaseLine) { var signatureBaseLine = new CustomUIBezierPath { LineWidth = 1, LineColor = UIColor.Black, LineJoinStyle = CGLineJoin.Round }; signatureBaseLine.MoveTo(_baseLineStart); signatureBaseLine.AddLineTo(_baseLineEnd); signatureBaseLine.Stroke(); _paths.Add(signatureBaseLine); } SetNeedsDisplay(); }
public UICaptureDrawView(CGRect frame, bool needBaseLine = true) : base(frame) { _paths = new NSMutableArray <CustomUIBezierPath>(); NeedBaseLine = needBaseLine; if (NeedBaseLine) { var signatureBaseLine = new CustomUIBezierPath { LineWidth = 1, LineColor = UIColor.Black, LineJoinStyle = CGLineJoin.Round }; _baseLineStart = new CGPoint(0, frame.Height - frame.Height / 32); _baseLineEnd = new CGPoint(frame.Width, frame.Height - frame.Height / 32); signatureBaseLine.MoveTo(_baseLineStart); signatureBaseLine.AddLineTo(_baseLineEnd); signatureBaseLine.Stroke(); _paths.Add(signatureBaseLine); } }