0

I push the new VC using navigationController?.pushViewController(vc, animated: true). In viewDidLoad I set the view to a custom view:

override func viewDidLoad() {
  let clubDetailsView = ClubDetailsView()
  self.view = clubDetailsView

In the view itself, I set the background color to blue and it looks like it covers the whole screen. But I want it to be until the navigator bar starts.

enter image description here

Artiom
  • 513
  • 1
  • 4
  • 15
  • Just wondering about your use case .. any reason for not adding your view as a subview to the main view ? – Shawn Frank Feb 10 '22 at 04:13
  • MVVM. Separating UI from the controller – Artiom Feb 10 '22 at 05:18
  • I don't think you will break `MVVM` by adding 5 lines of auto layout code to configure the layout of your `ClubDetailsView` in your view controller. All the `ClubDetailsView`'s responsibility is still contained within its scope. If you still feel this is the way you want to go, it is going to be quite difficult, especially once you use navigation controllers. Here are some options: https://stackoverflow.com/questions/13232214/changing-height-of-view-inside-uinavigationcontroller – Shawn Frank Feb 10 '22 at 06:25
  • https://stackoverflow.com/questions/10429127/change-uiviewcontroller-self-view-frame – Shawn Frank Feb 10 '22 at 06:25
  • https://stackoverflow.com/questions/33156607/changing-uiviewcontroller-views-frame – Shawn Frank Feb 10 '22 at 06:26
  • https://stackoverflow.com/questions/30683121/swift-change-uiviewcontrollers-view – Shawn Frank Feb 10 '22 at 06:26

0 Answers0