可能使用mono touch为ios构建具有电子签名功能的应用程序?

可能使用mono touch为ios构建具有电子签名功能的应用程序?,ios,objective-c,xamarin.ios,Ios,Objective C,Xamarin.ios,这只是一个简单的问题,因为我在谷歌上搜索过,只找到了已经具备此功能的应用程序——但我该如何创建一个能够捕获电子签名的应用程序……这可能吗?Xamarin的组件商店有一个这样做的组件 我也从零开始写过类似的东西——这并不特别难。代码如下所示: public class DrawView : UIView { DrawViewController dvc; // clear the canvas public void Clear ()

这只是一个简单的问题,因为我在谷歌上搜索过,只找到了已经具备此功能的应用程序——但我该如何创建一个能够捕获电子签名的应用程序……这可能吗?

Xamarin的组件商店有一个这样做的组件

我也从零开始写过类似的东西——这并不特别难。代码如下所示:

public class DrawView : UIView
    {

        DrawViewController dvc;

        // clear the canvas
        public void Clear ()
        {
            drawPath.Dispose ();
            drawPath = new CGPath ();
            fingerDraw = false;
            SetNeedsDisplay ();

        }

        // pass in a reference to the controller, although I never use it
and could probably remove it
        public DrawView (RectangleF frame, DrawViewController root) :
base(frame)
        {
            dvc = root;
            this.drawPath = new CGPath ();
            this.BackgroundColor = UIColor.White;

        }


        private PointF touchLocation;
        private PointF prevTouchLocation;
        private CGPath drawPath;
        private bool fingerDraw;

        public override void TouchesBegan (MonoTouch.Foundation.NSSet
touches, UIEvent evt)
        {
            base.TouchesBegan (touches, evt);

            UITouch touch = touches.AnyObject as UITouch;
            this.fingerDraw = true;
            this.touchLocation = touch.LocationInView (this);
            this.prevTouchLocation = touch.PreviousLocationInView (this);
            this.SetNeedsDisplay ();

        }

        public override void TouchesMoved (MonoTouch.Foundation.NSSet
touches, UIEvent evt)
        {
            base.TouchesMoved (touches, evt);

            UITouch touch = touches.AnyObject as UITouch;
            this.touchLocation = touch.LocationInView (this);
            this.prevTouchLocation = touch.PreviousLocationInView (this);
            this.SetNeedsDisplay ();
        }

        public UIImage GetDrawingImage ()
        {
            UIImage returnImg = null;

            UIGraphics.BeginImageContext (this.Bounds.Size);

            using (CGContext context = UIGraphics.GetCurrentContext()) {
                context.SetStrokeColor (UIColor.Black.CGColor);
                context.SetLineWidth (5f);
                context.SetLineJoin (CGLineJoin.Round);
                context.SetLineCap (CGLineCap.Round);
                context.AddPath (this.drawPath);
                context.DrawPath (CGPathDrawingMode.Stroke);
                returnImg = UIGraphics.GetImageFromCurrentImageContext ();
            }

            UIGraphics.EndImageContext ();

            return returnImg;
        }


        public override void Draw (RectangleF rect)
        {
            base.Draw (rect);

            if (this.fingerDraw) {
                using (CGContext context = UIGraphics.GetCurrentContext()) {
                    context.SetStrokeColor (UIColor.Black.CGColor);
                    context.SetLineWidth (5f);
                    context.SetLineJoin (CGLineJoin.Round);
                    context.SetLineCap (CGLineCap.Round);
                    this.drawPath.MoveToPoint (this.prevTouchLocation);
                    this.drawPath.AddLineToPoint (this.touchLocation);
                    context.AddPath (this.drawPath);
                    context.DrawPath (CGPathDrawingMode.Stroke);
                }
            }
        }
    }

谢谢,我会试试的!这太棒了!再次感谢!