我对刷新控制有一点问题。一切看起来不错但是当我导航到另一个视图控制器然后回来时,我得到了以下灰色空间:
我的代码:
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.leftBarButtonItem = UIBarButtonItem(image: UIImage(named: "add_employee.png"), style: UIBarButtonItemStyle.Plain, target: self, action: "showEmployeeRegisterView")
self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "sync.png"), style: UIBarButtonItemStyle.Plain, target: self, action: "syncData")
self.refreshControl = UIRefreshControl()
self.refreshControl.backgroundColor = UIColor.grayColor()
self.refreshControl.tintColor = UIColor.whiteColor()
self.refreshControl.attributedTitle = NSAttributedString(string: "ACTUALIZAR", attributes: [NSForegroundColorAttributeName: UIColor.whiteColor()])
self.refreshControl.addTarget(self, action: "loadData", forControlEvents: UIControlEvents.ValueChanged)
self.searchController = UISearchController(searchResultsController: nil)
self.searchController.searchBar.sizeToFit()
self.searchController.searchBar.delegate = self
self.searchController.searchResultsUpdater = self
self.searchController.dimsBackgroundDuringPresentation = false
self.searchController.searchBar.placeholder = "Buscar..."
self.searchController.searchBar.translucent = false
let nib = UINib(nibName: "CustomTableCell", bundle: nil)
self.tblEmployee.registerNib(nib, forCellReuseIdentifier: "cell")
self.tblEmployee.dataSource = self
self.tblEmployee.addSubview(refreshControl)
self.tblEmployee.tableHeaderView = searchController.searchBar
self.definesPresentationContext = true
}
正确的用户界面:
那么,我做错了什么?