Inherits from UIView
Declared in MAWMathView.h

Overview

The MAWMathView is the entry point of the Math Widget.

Tasks

Register the certificate

Configuring the Engine

Getting and Setting the Delegate

Managing Undo/Redo

Managing items

Configuring the Solver

Customizing Appearance

Customizing Padding

Importing Equations

Exporting Equations

Ignoring Unwanted Touches

Saving and Restoring recognitions results

Properties

angleUnit

Angle unit to be used in calculations.

@property (assign, nonatomic) MAWAngleUnit angleUnit

Discussion

The default value of this property is MAWAngleUnitDegree.

Declared In

MAWMathView.h

backgroundView

Background view of the writing area.

@property (strong, nonatomic) UIView *backgroundView

Discussion

The view is automatically resized to match the size of the Math Widget View.

The default background view is a UIImageView displaying a graph paper pattern. You can set this property to nil to remove the background.

Declared In

MAWMathView.h

baselineColor

Color of the baseline.

@property (strong, nonatomic) UIColor *baselineColor

Discussion

The default value of this property is [UIColor lightGrayColor].

Declared In

MAWMathView.h

baselinePattern

Dash pattern of the baseline.

@property (strong, nonatomic) NSArray *baselinePattern

Discussion

The dash pattern is specified as an array of NSNumber objects that specify the lengths of the painted segments and unpainted segments, respectively, of the dash pattern.

The default value for of this property is @[@8, @8]. The value should not be null neithe empty.

For example, passing an array with the values [2,3] sets a dash pattern that alternates between a 2-user-space-unit-long painted segment and a 3-user-space-unit-long unpainted segment. Passing the values [1,3,4,2] sets the pattern to a 1-unit painted segment, a 3-unit unpainted segment, a 4-unit painted segment, and a 2-unit unpainted segment.

Declared In

MAWMathView.h

baselinePhase

Dash phase of the baseline.

@property (assign, nonatomic) CGFloat baselinePhase

Discussion

A value that specifies how far into the dash pattern the line starts, in points.

The default value for of this property is 0.

Declared In

MAWMathView.h

baselineThickness

Thickness of the baseline in points.

@property (assign, nonatomic) CGFloat baselineThickness

Discussion

The default value of this property is 1. The min value is 1 and the max value is 10.

Declared In

MAWMathView.h

beautificationOption

Enable or disable solving and/or beautification of written equation.

@property (assign, nonatomic) MAWBeautifyOption beautificationOption

Discussion

The default value of this property is MAWBeautifyFontifyAndSolve. It replaces the previous settings solverEnabled (solverEnabled = NO => MAWBeautifyFontify and solverEnabled = YES => MAWBeautifyFontifyAndSolve).

Declared In

MAWMathView.h

decimalsCount

Number of decimals displayed in the result.

@property (assign, nonatomic) NSInteger decimalsCount

Discussion

Value must be between 0 and 6.

The default value of this property is 3.

Declared In

MAWMathView.h

delegate

The receiver’s delegate or nil if it doesn’t have a delegate.

@property (weak, nonatomic) id<MAWMathViewDelegate> delegate

Discussion

See MAWMathViewDelegate for the methods this delegate can implement.

Declared In

MAWMathView.h

font

Equation text font.

@property (strong, nonatomic) UIFont *font

Discussion

The default font used by the Math Widget is STIXGeneral.ttf, embedded in MathWidget.bundle. If the bundle cannot be loaded, the default system font is used. The font size does not matter since the text is dynamically determined by the Math Widget.

Declared In

MAWMathView.h

gesturesEnabled

Gestures that should be recognized. The default value of this property is MAWGesturesDefault, which means that both strike gesture and overwrite gesture are enabled.

@property (assign, nonatomic) MAWGestures gesturesEnabled

Declared In

MAWMathView.h

inkColor

Color of the ink.

@property (strong, nonatomic) UIColor *inkColor

Discussion

The default value of this property is [UIColor colorWithRed:75/255.0 green:87/255.0 blue:117/255.0 alpha:1].

Declared In

MAWMathView.h

inkThickness

Thickness of the ink.

@property (assign, nonatomic) CGFloat inkThickness

Discussion

This is the maximum thickness of the ink. Real thickness vary slightly to simulate pressure.

The default value of this property is 1.5. The min value is 1 and the max value is 10.

Declared In

MAWMathView.h

isBusy

Returns a Boolean value that indicates whether the recognition engine is currently busy.

@property (assign, nonatomic, readonly) BOOL isBusy

Return Value

YES if the recognition engine is currently busy, otherwise NO.

Declared In

MAWMathView.h

isEmpty

Returns a Boolean value that indicates whether the Math Widget contains items (ink or text).

@property (assign, nonatomic, readonly) BOOL isEmpty

Return Value

YES if the Math Widget does not contain any items, otherwise NO.

Declared In

MAWMathView.h

paddingRatio

Top, left, bottom and right padding of the writing area, used when doing equation layout.

@property (assign, nonatomic) UIEdgeInsets paddingRatio

Discussion

The user can write within the margins but no character will be displayed there. The values of the margins must be in the range 0.0 to 1.0. 0.0 means no margins. 1.0 means that the margin will take a quarter of the widget width/height. It replaces the previous writeAreaHorizontalMargin and writeAreaVerticalMargin APIs.

Declared In

MAWMathView.h

palmRejectionEnabled

A Boolean value that determines whether the Math Widget should ignore unwanted touches caused by the user palm.

@property (assign, nonatomic) BOOL palmRejectionEnabled

Discussion

The default value of this property is YES.

Declared In

MAWMathView.h

palmRejectionLeftHanded

A Boolean value that determines whether the Palm Rejection should be configured for left handed users.

@property (assign, nonatomic) BOOL palmRejectionLeftHanded

Discussion

The default value of this property is NO.

Declared In

MAWMathView.h

roundingMode

Rounding mode used by the solver.

@property (assign, nonatomic) MAWRoundingMode roundingMode

Discussion

The default value of this property is MAWRoundingModeTruncation.

Declared In

MAWMathView.h

textColor

Color of the text.

@property (strong, nonatomic) UIColor *textColor

Discussion

The default value of this property is [UIColor colorWithRed:75/255.0 green:87/255.0 blue:117/255.0 alpha:1].

Declared In

MAWMathView.h

transientTextColor

Color of the text added by the solver.

@property (strong, nonatomic) UIColor *transientTextColor

Discussion

The default value of this property is [UIColor lightGrayColor].

Declared In

MAWMathView.h

Instance Methods

addSearchDir:

Add given directory to handwriting resources search path. Directory name can point to a folder in the file system, or to a directory in a zip file.

- (void)addSearchDir:(NSString *)directoryName

Parameters

directoryName

Path to a folder containing handwriting resources.

Declared In

MAWMathView.h

addStroke:

Adds a stroke to the MyScript document model.

- (void)addStroke:(NSArray<MAWCaptureInfo*> *)points

Parameters

points

an NSArray of MAWCaptureInfo constituting the path of the stroke.

Declared In

MAWMathView.h

addSymbol:allowUndo:

Append a calculation symbol to the current recognition result.

- (void)addSymbol:(MAWSymbol *)symbol allowUndo:(BOOL)allowUndo

Parameters

symbol

The symbol to add.

allowUndo

Indicates whether the undo redo stack must be updated with additions.

Declared In

MAWMathView.h

addSymbols:allowUndo:

Append a calculation symbol list to the current recognition result.

- (void)addSymbols:(NSArray *)symbols allowUndo:(BOOL)allowUndo

Parameters

symbols

An array of symbols to add.

allowUndo

Indicates whether the undo redo stack must be updated with additions.

Declared In

MAWMathView.h

canRedo

Returns a Boolean value that indicates whether the Math Widget has any actions to redo.

- (BOOL)canRedo

Return Value

YES if the Math Widget has any actions to redo, otherwise NO.

Declared In

MAWMathView.h

canUndo

Returns a Boolean value that indicates whether the Math Widget has any actions to undo.

- (BOOL)canUndo

Return Value

YES if the Math Widget has any actions to undo, otherwise NO.

Declared In

MAWMathView.h

clear:

Clears the ink and the text.

- (void)clear:(BOOL)allowUndo

Parameters

allowUndo

YES to allow the undo, NO otherwise.

Declared In

MAWMathView.h

clearSearchPath

Clear handwriting resources search path.

- (void)clearSearchPath

Declared In

MAWMathView.h

configureWithBundle:andConfig:

Configure handwriting recognition engine. This method is non-blocking and returns immediately.

- (void)configureWithBundle:(NSString *)bundleName andConfig:(NSString *)configName

Parameters

bundleName

Name of the configuration bundle (for example, “math”).

configName

Name of the configuration mode (for example, “standard”).

Discussion

Configuration is a lengthy process that may take up to several seconds, depending on the handwriting resources to be configured. It is recommended to setup a configuration listener to detect the end of the configuration process.

Declared In

MAWMathView.h

penAbort

Simulate a pen abort event. This simulates a user writing.

- (void)penAbort

Declared In

MAWMathView.h

penDown:

Simulate a pen down event. This simulates a user that starts writing.

- (void)penDown:(MAWCaptureInfo *)captureInfo

Parameters

captureInfo

Capture information.

Declared In

MAWMathView.h

penMove:

Simulate a pen move event. This simulates a user writing.

- (void)penMove:(MAWCaptureInfo *)captureInfo

Parameters

captureInfo

Capture information.

Declared In

MAWMathView.h

penUp:

Simulate a pen up event. This simulates a user that ends writing.

- (void)penUp:(MAWCaptureInfo *)captureInfo

Parameters

captureInfo

Capture information.

Declared In

MAWMathView.h

redo

Performs one redo step.

- (void)redo

Declared In

MAWMathView.h

registerCertificate:

Register MyScript engine certificate.

- (BOOL)registerCertificate:(NSData *)certificate

Parameters

certificate

The data object containing the certificate.

Return Value

YES on success, NO on failure.

Declared In

MAWMathView.h

resultAsImage

Get the equation as an image.

- (UIImage *)resultAsImage

Return Value

A UIImage similar to what is is displayed by the Math Widget.

Declared In

MAWMathView.h

resultAsLaTeX

Get the equation as a LaTeX text string.

- (NSString *)resultAsLaTeX

Return Value

A NSString representing the LaTeX equation.

Declared In

MAWMathView.h

resultAsMathML

Get the equation as a MathML text string.

- (NSString *)resultAsMathML

Return Value

A NSString representing the MathML equation.

Declared In

MAWMathView.h

resultAsSymbolList

Get the equation as a symbol list.

- (NSArray *)resultAsSymbolList

Return Value

A NSArray of MAWSymbol.

Declared In

MAWMathView.h

resultAsText

Get the equation as a text string.

- (NSString *)resultAsText

Return Value

A NSString representing the equation, using the Math Widget string format.

Declared In

MAWMathView.h

serialize

Serialize the current input.

- (NSData *)serialize

Return Value

A data object containing the serialized equation.

Discussion

This method can be used to save an equation as binary data.

Declared In

MAWMathView.h

solve

Perform on demand solving. Becomes relevant when the beautificationOption is either MAWBeautifyDisabled or MAWBeautifyFontify.

- (void)solve

Declared In

MAWMathView.h

undo

Performs one undo step.

- (void)undo

Discussion

The behavior depends of the MAWBeautifyOption value and if the user write into a single shot (only one mathViewDidEndWriting: call) or severals.

Declared In

MAWMathView.h

unserialize:

Restore an input saved using the serialize method.

- (BOOL)unserialize:(NSData *)data

Parameters

data

The data to unserialize, provided by serialize.

Return Value

YES if the data was properly unserialized, NO otherwise.

Discussion

This method can be used to restore an equation from binary data.

Declared In

MAWMathView.h