swift ios 8 change font title of section in a tableview

前端 未结 11 1607
夕颜
夕颜 2021-01-31 08:29

I would like to change the font type and font size of a section header in a table view controller.

My code:

func tableView(tableView: UITableView, willDi         


        
11条回答
  •  梦毁少年i
    2021-01-31 08:58

    Xamarin/C#

    Based on Atticus' answer using willDisplayHeaderView:

    public override void WillDisplayHeaderView(UITableView tableView, UIView headerView, nint section)
    {
        var header = headerView as UITableViewHeaderFooterView;
        header.TextLabel.Font = UIFont.FromName("Futura", header.TextLabel.Font.PointSize);
    }
    

    Please note that Xamarin is a cross-platform development tool for building iOS Apps using the C# language. The code above is C# and will not work in Xcode. This answer is just for developers who use Xamarin but still want to achieve what the OP also wanted.

提交回复
热议问题