1
1

More than 3 years have passed since last update.

【Swift】Controllerとxibを繋げる方法

Last updated at Posted at 2019-03-02

一番簡単な方法は、controller.swiftcontroller.xibのファイル名を同じにする。

もしどうしても同じ名前にできない場合は、明示的にControllerからxibを紐付けることも可能。

override func loadView() {
    if let view = UINib(nibName: "xibName", bundle: nil).instantiateWithOwner(self, options: nil).first as? UIView {
    self.view = view
    }
}
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1