我已经重写了 moreNavigationController
tableview,但我想使用与 native moreNavigationController
的 tableview 数据源(tabbaritem 图标、名称和角标(Badge)等)默认相同的行.
我试图从现有数据源中获取单元格。下面是我的代码片段:
func tabBarController(tabBarController: UITabBarController, shouldSelectViewController viewController: UIViewController) -> Bool
{
if (viewController == tabBarController.moreNavigationController && tabBarController.moreNavigationController.delegate == nil)
{
if tabBarController.moreNavigationController.topViewController?.view is UITableView
{
let view:UITableView = tabBarController.moreNavigationController.topViewController?.view as! UITableView
tblDataSource = view.dataSource
view.delegate = self
view.dataSource = self
}
}
return true
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
let cell:UITableViewCell = tblDataSource?.tableView(tableView, cellForRowAtIndexPath: indexPath)
return cell
}
但是,它向我显示空白单元格。
最佳答案
您需要实现以下方法才能正确显示“更多” View Controller 的单元格:
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
tblDataSource?.tableView!(tableView, willDisplay: cell, forRowAt: indexPath)
}
关于ios - 自定义 moreNavigationController 的 tableview 和类似的用户界面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34040673/