UIView
class UIView : UIResponder, NSCoding, UIAppearance, UIAppearanceContainer, UIDynamicItem, UITraitEnvironment, UICoordinateSpace, UIFocusItem, UIFocusItemContainer, CALayerDelegate
-
Adds the given subview into the receiver, and adds constraint so that its top, bottom, left and right’s edges are bounds to its superview’s edges.
Declaration
Swift
public func addAndFitSubview(_ view: UIView)
-
Take a snapshot of the view and returns a
UIImage
.Note
The returns is an implicitely unwrapped optional for backward-compatibility purpose, and will be made an optional in a future release (as well as not crash)
Declaration
Swift
public func snapshotImage(afterScreenUpdates: Bool = true) -> UIImage!
Parameters
afterScreenUpdates
Please refer to the documentation for
afterScreenUpdates
inUIView.drawHierarchy(in:, afterScreenUpdates:)
for more info.Return Value
The image if it could be generated. If it couldn’t, for example if the
UIView
‘s width or height is 0, a crash will happen at runtime.