I created a UIView class and implemented it inside a viewcontroller. However, I have a some other things in the view controller that I want to be able to interact with but I cannot do that because of the attached view.
how do I interact with the base viewcontroller while the custom uiview is present in the viewcontroller
var tripView: TripView!
override func viewDidLoad() {
super.viewDidLoad()
tripView = TripView(frame: CGRect.zero)
self.view.addSubview(tripView)
// AutoLayout
tripView.autoPinEdgesToSuperviewEdges(with: UIEdgeInsets.zero)
}
You can do
You should assign proper index to your views by using following methods from UIView.
Instance Methods: aboveSubview and belowSubview or insertSubview .
Views can be nested inside other views to create view hierarchies, which offer a convenient way to organize related content. Nesting a view creates a parent-child relationship between the child view being nested (known as the subview) and the parent (known as the superview). A parent view may contain any number of subviews but each subview has only one superview. By default, when a subview’s visible area extends outside of the bounds of its superview, no clipping of the subview's content occurs.
Hope it helps!