Mostrar la barra de búsqueda en la barra de navegación en iOS 8

UISearchDisplayController tenía unboolean propiedad llamadadisplaysSearchBarInNavigationBar. ¿Cuál es el equivalente en iOS 8 para que mi barra de búsqueda se mueva allí? Cualquier orientación es muy apreciada.

Aquí está mi código, no estoy completamente seguro de por qué esto no funciona. Cuando hago clic en la barra de búsqueda, simplemente desaparece en lugar de moverse y la barra de navegación hacia arriba.

import UIKit

class ViewController: UIViewController, UISearchResultsUpdating, UISearchControllerDelegate, UISearchBarDelegate, UITableViewDelegate, UITableViewDataSource {

let searchController = UISearchController(searchResultsController:  nil)

var tableView = UITableView()

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.

    self.searchController.searchResultsUpdater = self
    self.searchController.delegate = self
    self.searchController.searchBar.delegate = self

    self.searchController.hidesNavigationBarDuringPresentation = true
    self.searchController.dimsBackgroundDuringPresentation = true

    tableView.dataSource = self
    tableView.delegate = self


    self.navigationItem.titleView = searchController.searchBar


    self.definesPresentationContext = true

    self.setupSearchBar()




}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

func updateSearchResultsForSearchController(searchController: UISearchController) {

}

func setupSearchBar() {

    // Set search bar position and dimensions
    var searchBarFrame: CGRect = self.searchController.searchBar.frame
    var viewFrame = self.view.frame
    self.searchController.searchBar.frame = CGRectMake(searchBarFrame.origin.x, searchBarFrame.origin.y + 64,viewFrame.size.width, 44)


    // Add search controller's search bar to our view and bring it to forefront
    self.view.addSubview(self.searchController.searchBar)

}

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    var cell = UITableViewCell()

    return cell
}

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return 5
}
}

Respuestas a la pregunta(1)

Su respuesta a la pregunta