with the help of this Thread I managed to alter the font of my UITableViewCellActionButtons, but now the line-separator for each cell only gets visible after swiping the cell once and the disclosure indicators never show up. Here is my extension-code:
extension UITableViewCell{
override open func layoutSubviews() {
super.layoutSubviews()
for subview in self.subviews {
for sub in subview.subviews {
if String(describing: sub).range(of: "UITableViewCellActionButton") != nil {
for view in sub.subviews {
if String(describing: view).range(of: "UIButtonLabel") != nil {
if let label = view as? UILabel {
label.font = UIFont(name: "CaptureSmallz", size: label.font.pointSize)
}
}
}
}
}
}
}
}
My cellforRowAt looks like this:
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "planNameCell", for: indexPath)
...
cell.textLabel?.text = ...
cell.detailTextLabel?.text = ...
cell.selectionStyle = UITableViewCellSelectionStyle.none
let textLabelFontSize = cell.textLabel?.font.pointSize
cell.textLabel?.font = UIFont(name: "CaptureSmallz", size: textLabelFontSize!)!
cell.textLabel?.sizeToFit()
let detailLabelFontSize = cell.detailTextLabel?.font.pointSize
cell.detailTextLabel?.font = UIFont(name: "CaptureSmallz", size: detailLabelFontSize!)!
cell.detailTextLabel?.sizeToFit()
return cell
}
I hope somebody knows what I messed up here. Thanks for the help!
//Edit 1: I've checked the view hierachy with the Xcode-Debugger, but it shows only a blank screen. But I can see the hierachy on the left side: see this screenshot // this is the state of the app I debugged
I noticed that there arent any views for the disclosure indicators and when I swipe left on a cell once the line separator appears and one _UITableViewCellSeparatorView entry gets added in the view hierachy. But I still don't know where to look now.
//Edit 2: I'm currently trying to get rid of the extension and call the code in it manually, but I can`t figure it out where to put it. I tried "viewDidAppear", but then the "UITableViewCellActionButton" aren't there yet. Is there a way to call function right after "editActionsForRowAt" has been called?