func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return leadername.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "leadCell") as! LeaderBoardTableViewCell
cell.leaderNameLbl.text = leadername[indexPath.row]
cell.areaLbl.text = areaName[indexPath.row]
cell.approvalLabel.text = approvalrate[indexPath.row]
cell.leaderImageView?.image = UIImage(named: leaderImage[indexPath.row])
cell.backgroundColor = UIColor.white
//cell.contentView.backgroundColor = transparentColor
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 85
}
私は多くのソリューションをチェックしましたが、どれも私のために働いていません。私はセルの高さ、テーブルビューの高さなどを変更しました。しかし、それは私のために働いていません。どうすればこれを達成できますか?助けてください。スワップアイオスの2つのカスタムテーブルビューセルの間にスペーシングを追加するには?
私の意見では、あなたの問題の2つの方法があります:1.各UITableViewCellは1つのセクションに表示されるので、各セクションのスペースを処理できます。 2. UITableViewCellで、contentViewを小さく設定すると、セル間のスペースが表示されます。 – nynohu
@nynohuどのようにコンテンツビューを小さく設定するのですか?あなたは私のコードでそれを行う方法を私に見せてもらえますか? – Rakesh
ユーザインタフェースを使用する場合は、すべてのコンテンツをcontentViewのサブビューに追加できます。また、このサブビューの表示サイズを調整して表示することもできます。 – nynohu