ios – 自定义moreNavigationController的tableview和类似的用户界面

前端之家收集整理的这篇文章主要介绍了ios – 自定义moreNavigationController的tableview和类似的用户界面前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经覆盖了moreNavigationController tableview,但是我想使用默认为nativeNavigationController的tableview数据源的相同行(tabbaritem图标,名称和徽章等).
我试图从现有的数据源中获取单元格.以下是我的代码片段:

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
}

但是,它显示了我的空白细胞.

解决方法

您需要实现以下方法才能正确显示“更多”视图控制器的单元格:

func tableView(_ tableView: UITableView,willDisplay cell: UITableViewCell,forRowAt indexPath: IndexPath) {
    tblDataSource?.tableView!(tableView,willDisplay: cell,forRowAt: indexPath)
}

猜你在找的Xcode相关文章