What´s the difference between view
and superview
?
let fromViewController = self.source
let containerView = fromViewController.view.superview
What´s the difference between view
and superview
?
let fromViewController = self.source
let containerView = fromViewController.view.superview
Suppose that
let v1 = UIView()
parent.addSubview(v1)
here
v1 ----- >>> v1 ( The view itself )
v1.superview ------- >>> parent
Views are the fundamental building blocks of your app's user interface, and the UIView class defines the behaviors that are common to all views. A view object renders content within its bounds rectangle and handles any interactions with that content.
let rect = CGRect(x: 10, y: 10, width: 100, height: 100)
let myView = UIView(frame: rect)
The superview is the immediate ancestor of the current view. The value of this property is nil when the view is not installed in a view hierarchy. To set the value of this property, use the addSubview(_:) method to embed the current view inside another view.
let rect = CGRect(x: 10, y: 10, width: 100, height: 100)
let myView = self.view.addSubview( UIView(frame: rect))