简体   繁体   English

如何在另一个ViewController中加载UIViewController XIB?

[英]How to load UIViewController XIB inside another ViewController?

I am trying to add a UIViewController XIB to an existing ViewController , trying to create this: 我试图将UIViewController XIB添加到现有的ViewController ,尝试创建以下代码:

在此处输入图片说明

I have a simple ViewController and then I made a UIView with XIB ... and now I am trying to use it in the new ViewController : 我有一个简单的ViewController ,然后用XIB制作了一个UIView ...,现在我试图在新的ViewController使用它:

    let myVC = XIBViewController(nibName: "XIBViewController.xib", bundle: nil)
    self.present(myVC, animated: true, completion: nil)

How can I make it as small as in the image, with the BaseViewController still visible? 如何在与BaseViewController使其与图像一样小?

Replace ( Remove .xib ) 替换(删除.xib

let myVC = P3XIBViewController(nibName: "P3XIBViewController.xib", bundle: nil)

with

let myVC = P3XIBViewController(nibName: "P3XIBViewController", bundle: nil)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM