0
我正在使用SWRevealViewController,当我创建单元格并运行应用程序时,侧面菜单显示空白。然而,一旦你点击其中一个单元格,单元格就会出现。当您点击它时,顶部较大的单元格仍然不会显示。这是我的代码。SWRevealViewController单元显示空白,直到单击
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return menuTitle.count+3
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let index = indexPath.row
var defCell: UITableViewCell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as UITableViewCell
switch (index) {
case 0:
let cell = tableView.dequeueReusableCell(withIdentifier: "profileCell") as! profileCell
cell.nameLbl.text = "Name Here" //need to pull name from the database here
cell.profileImg.image = UIImage(named: "face")! //pull from db
print(cell)
return cell
case 1:
let cell = tableView.dequeueReusableCell(withIdentifier: "labelCell") as! labelCell
cell.menuLabel.text = "For Sale"
return cell
case 2,3,4:
let cell = tableView.dequeueReusableCell(withIdentifier: "titleCells") as! titleCells
cell.cellImg.image = iconImg[indexPath.row - 2]
cell.cellName.text! = menuTitle[indexPath.row - 2]
return cell
case 5:
let cell = tableView.dequeueReusableCell(withIdentifier: "labelCell") as! labelCell
cell.menuLabel.text = "Profile"
//labelCell.darkLine //cahnge line color to orange
return cell
case 6,7,8,9,10,11:
print(indexPath.row)
let cell = tableView.dequeueReusableCell(withIdentifier: "titleCells") as! titleCells
cell.cellImg.image = iconImg[indexPath.row - 3]
cell.cellName.text! = menuTitle[indexPath.row - 3]
print(menuTitle[indexPath.row - 3])
return cell
case 12:
//change line color
let cell = tableView.dequeueReusableCell(withIdentifier: "titleCells") as! titleCells
cell.cellImg.image = iconImg[indexPath.row - 3]
cell.cellName.text! = menuTitle[indexPath.row - 3]
return cell
case 13:
let cell = tableView.dequeueReusableCell(withIdentifier: "titleCells") as! titleCells
cell.cellImg.image = iconImg[indexPath.row - 3]
cell.cellName.text! = menuTitle[indexPath.row - 3]
return cell
default:
return defCell
}
除switch语句以外的任何提示或其他方法都会有所帮助。提前致谢。
你是个巫师离队不止一个小区。谢谢! – ttorbik
很高兴为您服务 – Malik