Interactive Ink

How to erase stroke?

Hello,

I want to erase stroke by an eraser ,not gesture or undo。

I'm using swift iink, do you have any sample codes?





image








Dear Qian Bin,


thank you for your question.


Currently, you should set the IINKPointerType to Eraser:


typedef NS_ENUM(NSUInteger, IINKPointerType ) {
    IINKPointerTypePen,
    IINKPointerTypeTouch,
    IINKPointerTypeEraser,
 };


(see http://cocoadocs.org/docsets/MyScriptInteractiveInk-Runtime/1.0.0/Constants/IINKPointerType.html).


If you are using the pointerEvents API to add strokes from an external device, you can set the type variable in the following functions:

-for pointerMove, pointerUp and pointerDown, you should set "type:(IINKPointerType)type" to IINKPointerTypeEraser

-if using the pointerEvents function (which we rather recommend when inputting strokes from an external device), you should set the IINKPointerTypeEraser to each PointerEvent


Let us know if you need further explanation.


Best regards,


Olivier

Hello 

     Thank you for your detail explain, but I still need some help, after read your document and search the forums I write codes like below , but it doesn't work 

 

 @IBAction func btnEraserClick(_ sender: Any)
    {
        let dd = ViewControllerOC()
        dd.ocTes(editorViewControllerDo.editor)
    }

  

- (void)OcTes:(IINKEditor *) editor
{
    [editor pointerDown:CGPointMake(0.0f, 0.0f) at:(int64_t)-1 force:0.0f type:IINKPointerTypeEraser pointerId:-1 error:nil];
    [editor pointerMove:CGPointMake(0.0f, 0.0f) at:(int64_t)-1 force:0.0f type:IINKPointerTypeEraser pointerId:-1 error:nil];
    [editor pointerUp:CGPointMake(0.0f, 0.0f) at:(int64_t)-1 force:0.0f type:IINKPointerTypeEraser pointerId:-1 error:nil];
    printf("oc test");
}

 

   I'm new to ios ,now I'm using swift to make my app,so it would be better if you give me some swift code ,first I tried swift but  failed,because I don't know how to deal with the parameters.

image


Login or Signup to post a comment