在Interface Builder中创建UISearchController

时间:2019-07-02 13:37:00

标签: ios interface-builder

我要使用界面生成器和对象,而不是通过编程方式创建UISearchController。

我做了什么:

  • 我有一个故事板,带有一个名为ViewController的UIViewController。
  • 我将一个Object添加到ViewController并将一个自定义类设置为 UISearchController。
  • 在ViewController中,我添加@IBOutlet weak var customSearchController: UISearchController!
  • 然后我在界面中链接 为customSearchController生成一个自定义对象。
  • 我启动应用程序,并在viewDidLoad方法中,检查customSearchController对象的searchBar属性
  

po searchController.searchBar

     

日志输出:未初始化

searchBar属性为只读,因此无法在其上设置自定义UISearchBar。

是否可以在Interface Builder中创建UISearchController?

0 个答案:

没有答案