Skip to content

NotchImageView

Ahmed Fathi Bekhit edited this page Nov 10, 2017 · 3 revisions

Class

NotchImageView

NotchImageView is the class that handles initializing and configuring a NotchBar with a UIImage, initializing the protocols, and triggering protocols when events are changed.

Topics

Initializing and Configuring

var delegate: NotchToolbarDelegate?

The delegate object that handles device orientation changes and toolbar icon selection.

var notch: NotchBar

The variable that initializes and draws a NotchBar.

var onlyFor10: Bool

A boolean that allows you to configure whether you want to show the NotchBar only on iPhone X or older iPhone devices too. Default is false.

var printBarHeight: CGFloat

A CGFloat that allows configuring the printing bar height. Default is 3.0

var printBarColor: UIColor

A UIColor that allows configuring the printing bar color. Default is UIColor.cyan

var durationIntervals: TimeInterval

A TimeInterval that allows configuring the animation duration used in load(). Default is 3.0

init(image: UIImage?)

Initialize with a UIImage

func prepare(in vc:UIViewController)

Prepares the NotchImageView with default configurations in a UIViewController. To customize your NotchImageView, make sure to configure it with the new settings before calling prepare(in vc:UIViewController).

Displaying and Resizing

func load()

A method that allows you to load an image from the device's notch with animation.

func remove()

A method that allows you to remove the loaded image from the superview.

func autoResize()

A method that automatically resize the NotchBar. You must call this method in deviceDidRotate delegate in order to have the NotchBar working properly in different device orientations.