iOS: can not create custom view on UITableViewController

前端 未结 2 1068
耶瑟儿~
耶瑟儿~ 2021-01-28 17:01

What am I doing?
I am learning iOS by building an app. My requirement shows some transactions on UITableViewController

I

2条回答
  •  执念已碎
    2021-01-28 18:01

    The view you've added the labels to is your view controller's main view. You will need to drag a View from your object library (bottom right menu) and add those labels in it. Then link the added view to your ViewController with an IBOutlet. After that you can set your tableView's header to be the added view:

    self.tableView.tableHeaderView = headerView;
    

    EDIT: If you want to do everything in code. Create the custom header view and drag it above your UITableView: https://stackoverflow.com/a/8053361/2604030

提交回复
热议问题