OverlayTemplate
open class OverlayTemplate : UIView, OverlayView
A template class for overlays.
-
An UIStackView instance using to store the overlay subviews. You can use it to adjust alignment or spacing. Also, you can use it to create border constraints for UIView instances used for addView() method.
Declaration
Swift
public let stackView: UIStackView
-
Undocumented
Declaration
Swift
required public init?(coder aDecoder: NSCoder)
-
Creates an instance of the overlay template that is ready for use with Overlays library.
Declaration
Swift
public init(alignment: OverlayTemplateAlignment = .center, margins: UIEdgeInsets = UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20))
Parameters
alignment
alignment of the overlay. If not specified, items will be in the center of the overlay.
margins
margins of the overlay view. By default, it’s 20 for each corner.
-
Adds an UILabel instance with the specified text, .headline text style, and black color.
Declaration
Swift
open func addHeadline(_ text: String)
Parameters
text
a text to display.
-
Adds an UILabel instance with the specified text, .subheadline text style, and black color.
Declaration
Swift
open func addSubhead(_ text: String)
Parameters
text
a text to display.
-
Adds an UILabel instance with the specified text, font, and color.
Declaration
Swift
open func addText(_ text: String, font: UIFont, color: UIColor)
Parameters
text
a color of the text.
text
a color of the text.
text
a color of the text.
-
Adds an UIImageView instance displayed an UIImage with the specified name.
Declaration
Swift
open func addImage(named: String)
Parameters
named
an image name in the project assets catalog.
-
Adds an UIImageView instance displayed the specified image.
Declaration
Swift
open func addImage(_ image: UIImage)
Parameters
image
an image to display.
-
Adds an UIButton instance with .system style.
Declaration
Swift
open func addButton(_ text: String, listener: @escaping () -> Void)
Parameters
text
a text of the button.
listener
a closure for listening .touchUpInside events of the button.
-
Adds a separator.
Declaration
Swift
open func addSeparator(_ size: CGFloat)
Parameters
size
a size of the separator.
-
Adds the specified view. Please note that the view must have forced height or the intrinsic content size.
Example:
let view = UIView() view.heightAnchor.constraint(equalToConstant: 30).isActive = true addView(view) let label = UILabel() label.text = "example" addView(label)
Declaration
Swift
open func addView(_ view: UIView)
Parameters
view
a view to display.