Informations :
I am trying to swap two .xib
which will be inside UIView
of my StepsUIViewController class. And I set their file owner name as my StepsUIViewController because I want to do their procedures inside that view controller and that is the important thing at this topic.
Requirement :
My requirement is changing the two
xib
base on each situation. So, since I set their file owner name as StepsUIViewController, implementation of bothxib
will be done inside StepsUIViewController.
And I am going to present that StepsUIViewController modally. So there will be no UINavigationBar
until I drag and drop from tools.
Here is my view hierachy :
And here is my StepsUIViewController :
So inside Step1View
, I will change the two xib I created base on push(UIButton) action. Now here comes the problem. When I load those xib, UINavigationBar didn't appear as well as push
button also disappear and instead that xib(UIView) cover the whole StepsUIViewController
.
Here is my code :
import UIKit
class StepsViewController: UIViewController{
@IBOutlet weak var step1View : UIView!
override func loadView() {
super.loadView()
let someView = NSBundle.mainBundle().loadNibNamed("StepsInfo", owner: self, options:nil)[0]
step1View = someView as! UIView
}
}
Here what I am facing :
What am I doing wrong? I am new to xib and all my life dropping UIComponents to UIViewController
inside storyboard and I am thinking to change it and create view dynamically on single UIViewController. Any Help?