从Split View控制器的不同文件加载数据

时间:2016-02-05 09:12:28

标签: ios swift uisplitviewcontroller

我有3个例子。 但是有很多。我希望从不同的文件上传例如“name:file1”“category:file 2”

// MARK: - Properties
var detailViewController: DetailViewController? = nil
var candies = [Candy]()
var filteredCandies = [Candy]()
let searchController = UISearchController(searchResultsController:     nil)

// MARK: - View Setup
override func viewDidLoad() {
   super.viewDidLoad()

   // Setup the Search Controller
   searchController.searchResultsUpdater = self
   searchController.searchBar.delegate = self
   definesPresentationContext = true
   searchController.dimsBackgroundDuringPresentation = false

   // Setup the Scope Bar
   searchController.searchBar.scopeButtonTitles = ["All", "Chocolate","Hard", "Other"]
   tableView.tableHeaderView = searchController.searchBar

   candies = [
       Candy(category:"Chocolate", name:"Chocolate Bar"),
       Candy(category:"Chocolate", name:"Chocolate Chip"),
       Candy(category:"Qukullad", name:"keks")]

   if let splitViewController = splitViewController {
       let controllers = splitViewController.viewControllers
       detailViewController = (controllers[controllers.count-1] as! 
     UINavigationController).topViewController as? DetailViewController
   }
}

0 个答案:

没有答案