我想在导航堆栈中显示的每个视图控制器上都有一个关闭按钮。我在这里读到我需要创建一个 uinavigationdelegate 对象,我认为这个对象将有一个像 didTapCloseButton? 的方法?
问题:我应该创建一个协议并使一切都确认它,即:
protocol CustomDelegate: UINavigationControllerDelegate {
   func didTapCloseButton()
}
public class ViewController: CustomDelegate {
   func didTapCloseButton() {
     //not sure what goes in here?
   }
}
Run Code Online (Sandbox Code Playgroud)
如何让关闭按钮显示在每个视图的导航栏上?当用户单击关闭按钮时,如何关闭该堆栈上的每个视图?
感谢您的帮助!
我有一个分组表视图,想要更改节标题的字体样式。我努力了:
func tableView(tableView: UITableView, willDisplayHeaderView view: UIView,
               forSection section: Int) {
  let header = view as! UITableViewHeaderFooterView
  header.textLabel?.font = UIFont(name: "Futura", size: 11)
}
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
    let view = UITableViewHeaderFooterView.init(frame: CGRect.init(x: 0, y: 0, width: tableView.bounds.width, height: tableView.sectionHeaderHeight))
    view.contentView.layoutMargins = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20)
    view.contentView.backgroundColor = UIColor.init(red: 235/255, green: 235/255, blue: 235/255, alpha: 0)
    let label = UILabel.init(frame: CGRect.init(x: 20, y: 0, width: tableView.bounds.width, height: tableView.sectionHeaderHeight))
    label.font …Run Code Online (Sandbox Code Playgroud)