示例代码:
class ViewController: UIViewController {
private var navigationView: NavigationView?
override func viewDidLoad() {
super.viewDidLoad()
navigationView = NavigationView.init(frame: view.bounds,
middleView: MiddleView(),
screens: [
ScreenObject(title: "MUSIC",
startColor: .red,
endColor: .blue,
image: UIImage(named : "image1")!,
controller: YourFirstViewController()),
ScreenObject(title: "EDUCATION",
startColor: .black,
endColor: .white,
image: UIImage(named : "image2")!,
controller: YourSecondViewController()),
],
backgroundImage: #imageLiteral(resourceName: "background"))
navigationView?.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.addSubview(navigationView!)
}
}