分割视图控制器存在很大问题。代码工作得很好但是在一个文件中有很多信息要分成两个或多个文件。我想完成这个,所以信息从不同的文件加载。
例如:category.swift,name.swift viewcontroller.swift中加载的文件
// 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"),
..........大概有3000个这样的例子
Candy(category:"Qukullad", name:"keks")]
if let splitViewController = splitViewController {
let controllers = splitViewController.viewControllers
detailViewController = (controllers[controllers.count-1] as! UINavigationController).topViewController as? DetailViewController
}
}