TCMaskView

Swift

class TCMaskView : NSObject

Objective-C

@interface TCMaskView : NSObject

The module that displays a UIViewController for image masking. A minimum implementation to present a TCMaskview within a UIViewController class is:

// Create TCMaskView, specifying the image for masking.
let maskView = TCMaskView(image: self.image)

// Present TCMaskView from current view controller.
maskView.present(from: self, animated: true)
  • Initialize a TCMaskView

    Declaration

    Swift

    init(image: UIImage)

    Objective-C

    - (nonnull instancetype)initWithImage:(UIImage * _Nonnull)image;
  • Optional delegate object that receives exit/completion notifications from this TCMaskView.

    Declaration

    Swift

    weak var delegate : TCMaskViewDelegate?

    Objective-C

    @property (nonatomic, weak) id  _Nullable delegate;
  • View modes of TCMaskView, if no viewModes is provided or by default, TCMaskView will use the following view modes:

    viewModes[0] = TCMaskViewMode(foregroundColor: UIColor(white: 1, alpha: 0.5), backgroundImage: nil, isInverted: true);
    viewModes[1] = TCMaskViewMode.transparent
    viewModes[2] = TCMaskViewMode(foregroundColor: UIColor.black, backgroundImage: nil, isInverted: true)

    Declaration

    Swift

    var viewModes: [TCMaskViewMode]

    Objective-C

    @property (nonatomic, copy) NSArray * _Nonnull viewModes;
  • Initial tool when TCMaskView is presented

    Declaration

    Swift

    var initialTool: TCMaskTool

    Objective-C

    @property (nonatomic) enum TCMaskTool initialTool;
  • True if the status bar should be hidden or false if it should be shown.

    Declaration

    Swift

    var prefersStatusBarHidden: Bool

    Objective-C

    @property (nonatomic) BOOL prefersStatusBarHidden;
  • The style of the device’s status bar.

    Declaration

    Swift

    var statusBarStyle: UIStatusBarStyle

    Objective-C

    @property (nonatomic) UIStatusBarStyle statusBarStyle;
  • Top bar of TCMaskView

    Declaration

    Swift

    var topBar: TCUIView

    Objective-C

    @property (nonatomic, strong) TCUIView * _Nonnull topBar;
  • Bottom bar of TCMaskView

    Declaration

    Swift

    var bottomBar: TCUIView

    Objective-C

    @property (nonatomic, strong) TCUIView * _Nonnull bottomBar;
  • Tool panel of TCMaskView

    Declaration

    Swift

    var toolPanel: TCUIView

    Objective-C

    @property (nonatomic, strong) TCUIView * _Nonnull toolPanel;
  • Setting view of TCMaskView

    Declaration

    Swift

    var settingView: TCUIView

    Objective-C

    @property (nonatomic, strong) TCUIView * _Nonnull settingView;
  • Image view of TCMaskView

    Declaration

    Swift

    var imageView: TCUIView

    Objective-C

    @property (nonatomic, strong) TCUIView * _Nonnull imageView;
  • Presents the TCMaskView controller modally, which takes over the entire screen until the user closes or completes it.

    Set rootViewController to the current view controller at the time this method is called.

    Delegates:

    tcMaskViewDidExit: is called before TCMaskView is about to exit

    tcMaskViewDidComplete: is called before TCMaskView is about to complete

    Declaration

    Swift

    open func presentFrom(rootViewController: UIViewController, animated: Bool)

    Objective-C

    - (void)presentFromRootViewController:(UIViewController * _Nonnull)rootViewController animated:(BOOL)animated;

    Parameters

    rootViewController

    The root view controller from which TCMaskView controller is presented

    animated

    Specify true to animate the transition or false if you do not want the transition to be animated.

  • Pushes a TCMaskView controller onto the navigationController’s stack and updates the display.

    TCMaskView becomes the top view controller on the navigation stack. Pushing a view controller causes its view to be embedded in the navigation interface. If the animated parameter is true, the view is animated into position; otherwise, the view is simply displayed in its final location.

    In addition to displaying the view associated with the new view controller at the top of the stack, this method also updates the navigation bar and tool bar accordingly. For information on how the navigation bar is updated, see Updating the Navigation Bar.

    Delegates:

    tcMaskViewDidExit: is called before TCMaskView is about to exit

    tcMaskViewDidComplete: is called before TCMaskView is about to complete

    tcMaskViewWillPushViewController: is called before navigation controller is about to accomplish TCMaskView and process to the next UIViewController

    Declaration

    Swift

    open func presentFrom(navigationController: UINavigationController, animated: Bool)

    Objective-C

    - (void)presentFromNavigationController:(UINavigationController * _Nonnull)navigationController animated:(BOOL)animated;

    Parameters

    navigationController

    UINavigationController onto which TCMaskView is pushed

    animated

    Specify true to animate the transition or false if you do not want the transition to be animated.

  • Set the initial mask value of TCMaksView.

    Declaration

    Swift

    func setInitialMask(_ mask: UInt8)

    Objective-C

    - (void)setInitialMaskWithValue:(uint8_t)mask;

    Parameters

    mask

    Initial mask value, the entire initial mask will be filled with this value

  • Set the initial mask value of TCMaksView.

    Declaration

    Swift

    func setInitialMask(_ mask: [UInt8])

    Objective-C

    - (void)setInitialMaskWithArray:(NSArray * _Nonnull)mask;

    Parameters

    mask

    Initial mask value, mask length should match TCMaskView image size (mask.count == image.size.width * image.size.height)

  • Set the initial mask value of TCMaksView.

    Declaration

    Swift

    func setInitialMask(_ mask: [UInt8], size: CGSize)

    Objective-C

    - (void)setInitialMask:(NSArray * _Nonnull)mask size:(CGSize)size;

    Parameters

    mask

    Initial mask value

    size

    Size of mask, mask length should match size (mask.count == size.width * size.height), if size is not the same as image size, the initial mask will be scalled to fit image size.