0
嘿,大家我在這裏有一些問題,我會盡我所能地盡力解釋。所以我有一個集合視圖,其中包含一個集合視圖單元格,並且該單元格內嵌入的是一個表格視圖,並且在該表格視圖中,我希望返回3(用於未來測試更多)單元格,這將返回3個表格視圖。有了這些表格我想要有不同類型的數據,但我想知道我可以如何做到這一點,或者如果可能的話,我的故事板中只有一個表格視圖。我已經試圖嘗試這個,但所有事情都以零爲單位返回。提前致謝!單個集合視圖單元格內的控制表視圖
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
if tableView == tableview1 {
return 0;
} else if tableView == tableview2 {
return 3
}
return 0;
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
if tableView == tableview1 {
return 2;
} else if tableView == tableview2 {
return 1;
}
return 0;
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath)
if tableView == tableview1 {
cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath)
} else if tableView == tableview2 {
cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath)
}
// Configure the cell...
if tableView == tableview1 {
cell.textLabel?.text = "Homeroom"
cell.detailTextLabel?.text = "8:15 AM - 9:00 AM"
cell.selectionStyle = .None
} else if tableView == tableview2 {
cell.textLabel?.text = "Test Table 2 "
cell.detailTextLabel?.text = "1:30 PM - 2:30 PM"
cell.selectionStyle = .None
}
return cell
}