0
我使用两个tableviews显示数据。我的编码如下。我收到这样的错误[图片1]。我不知道如何解决这个问题。请帮助我。如果我测试1个表,它工作正常。但是,当使用两张表时,这种类型的错误即将到来。另外,为什么我收到此错误。请检查我的代码。
override func viewDidLoad() {
super.viewDidLoad()
self.country_table_view.registerClass(UITableViewCell.self, forCellReuseIdentifier: "countries")
self.laws_table_view.registerClass(UITableViewCell.self, forCellReuseIdentifier: "laws")
self.country_table_view.rowHeight = 60
self.laws_table_view.rowHeight = 60
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if(tableView == country_table_view)
{
return self.countries.count
}
else
{
return self.laws_title.count
}
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
if(tableView == laws_table_view)
{
var cell_new = tableView.dequeueReusableCellWithIdentifier("laws", forIndexPath: indexPath) as laws_TblVwCell
cell_new.laws_label.text = laws_title[indexPath.row]
return cell_new
}
else
{
var cell = tableView.dequeueReusableCellWithIdentifier("countries", forIndexPath: indexPath) as country_TblVwCell
cell.country_name_label.text = self.countries[indexPath.row]
return cell
}
}
嗨大卫.. !!但是当我们加载一个表时,两个表格正在工作。但是,当我们加载两个,我得到这个错误。 – 2015-02-10 17:22:08
那么不知道,我所知道的只是错误消息所说的和一个非常不完整的代码示例。检查堆栈跟踪并查看是否可以确切地确定哪个转换失败,但给定代码中只有2个选项。 – 2015-02-10 17:25:18
当然我会仔细检查..!还有一件事,你可以检查一下并解释我。 http://stackoverflow.com/questions/28325384/in-swift-dynamic-height-for-uitextview-in-uicollectionview – 2015-02-10 17:29:20