[英]Customise moreNavigationController's tableview and similar user interface
我已經覆蓋了moreNavigationController
tableview,但是我想使用默認為moreNavigationController
的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)
}
好的,我不明白。 如果您想要與本機相同的行,那么為什么要覆蓋UITableViewDataSource方法? 保持原樣。 覆蓋您需要的必要方法。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.