Как это выглядит
Я пытаюсь сделать так, чтобы каждое имя символов все больше и больше отступало с каждой строкой, поэтому слева, затем следующий ряд идет немного правее, а затем следующий ряд немного правее.
Я просто не могу понять, почему я не могу сделать отступ для своих ярлыков один за другим. Любая помощь приветствуется.
class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
var Dwarves = ["Sleepy", "Sneezy", "Bashful", "Dopy", "Grumpy", "Doc", "Happy", "Sad"]
var imagess = ["Sleepy", "Sneezy", "Bashful", "Dopy", "Grumpy", "Doc", "Happy", "Sad"]
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return Dwarves.count
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 100
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "customCell") as! CustomTableViewCell
cell.CellView.layer.cornerRadius = cell.CellView.frame.height / 2
cell.Label.text = Dwarves[indexPath.row]
cell.CharcterImage.image = UIImage(named:
imagess[indexPath.row])
cell.CharcterImage.layer.cornerRadius = cell.CharcterImage.frame.height / 2
return cell
}
func tableView(_ tableView: UITableView, indentationLevelForRowAt indexPath: IndexPath.) -> Int {
}
}
Я пытался использовать indentationLevelforRowAt
, но, похоже, он не работает.
import UIKit
class CustomTableViewCell: UITableViewCell {
@IBOutlet weak var CellView: UIView!
@IBOutlet weak var CharcterImage: UIImageView!
@IBOutlet weak var Label:UILabel!
@IBOutlet weak var TableView:UITableView!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}