大佬教程收集整理的这篇文章主要介绍了swift – 从不调用cellForRowAtIndexPath,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
当我在模拟器中运行应用程序时,从不调用其中一个数据源函数“cellForRowATindexPath”,但调用“numberOfRowsInSection”
>“func tableView(tableView:UITableView,numberOfRowsInSection section:int) – > Int”被调用
>但是“func tableView(tableView:UITableView,cellForRowATindexPath indexPath:NSIndexPath) – > UITableViewCell”从未被调用过
下面是我的视图控制器代码:
import UIKit class DVViewController: UIViewController,UITableViewDelegate,UITableViewDatasource { @IBOutlet var tableView : UITableView? var tableData = ["Row 1","Row 2","Row 3"] let kCellID = "cell" override func viewDidLoad() { super.viewDidLoad() self.tableView?.delegate = self; self.tableView?.datasource = self; //load cell self.tableView?.registerClass(UITableViewCell.self,forCellReusEIDentifier: kCellID); self.tableView?.reloadData(); } //MARK: Tableview delegates func tableView(tableView: UITableView,numberOfRowsInSection section: int) -> Int { return self.tableData.count; } func tableView(tableView: UITableView,cellForRowATindexPath indexPath: NSIndexPath) -> UITableViewCell { //var cell: UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Default,reusEIDentifier: kCellID) let cell : UITableViewCell = UITableViewCell (style: UITableViewCellStyle.Default,reusEIDentifier: kCellID); return cell; } }
有人可以建议为什么从不调用“cellForRowATindexPath”,它曾经在Xcode6 beta 2中工作.
@H_502_4@以上是大佬教程为你收集整理的swift – 从不调用cellForRowAtIndexPath全部内容,希望文章能够帮你解决swift – 从不调用cellForRowAtIndexPath所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。