{"id":15037453,"url":"https://github.com/aunnnn/tableheaderviewwithautolayout","last_synced_at":"2025-10-28T09:40:41.166Z","repository":{"id":41755073,"uuid":"93516038","full_name":"aunnnn/TableHeaderViewWithAutoLayout","owner":"aunnnn","description":"Example of how to use AutoLayout with table header view.","archived":false,"fork":false,"pushed_at":"2017-06-28T06:29:59.000Z","size":128,"stargazers_count":77,"open_issues_count":1,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T23:28:26.302Z","etag":null,"topics":["ios","swift","swift3","uitableview"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aunnnn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-06T12:30:04.000Z","updated_at":"2024-10-12T12:28:45.000Z","dependencies_parsed_at":"2022-09-13T15:12:17.169Z","dependency_job_id":null,"html_url":"https://github.com/aunnnn/TableHeaderViewWithAutoLayout","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aunnnn/TableHeaderViewWithAutoLayout","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aunnnn%2FTableHeaderViewWithAutoLayout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aunnnn%2FTableHeaderViewWithAutoLayout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aunnnn%2FTableHeaderViewWithAutoLayout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aunnnn%2FTableHeaderViewWithAutoLayout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aunnnn","download_url":"https://codeload.github.com/aunnnn/TableHeaderViewWithAutoLayout/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aunnnn%2FTableHeaderViewWithAutoLayout/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281418071,"owners_count":26497723,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","swift","swift3","uitableview"],"created_at":"2024-09-24T20:34:40.261Z","updated_at":"2025-10-28T09:40:41.150Z","avatar_url":"https://github.com/aunnnn.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TableHeaderViewWithAutoLayout\nExample of how to use AutoLayout with table header view. \n\nIt comes with UITableView's extension that helps you do this easily.\n\nThere are two examples:\n1. using UITableView (with header view Xib) \n2. using UITableViewController (all in storyboard).\n\nRequirements: Xcode 8, Swift 3, iOS 9+ (use anchors)\n\nMore detail [here](https://medium.com/@aunnnn/table-header-view-with-autolayout-13de4cfc4343)\n\n![alt gif](http://g.recordit.co/6NIcSgwwSF.gif)\n\n\n## How to use\n1. In viewDidLoad()\n```swift\n// 1. Setup AutoLayout (do this instead of setting constraints via storyboard)\nself.tableView.setTableHeaderView(headerView: self.tableView.tableHeaderView!)\n\n// 2. Initial layout update\nself.tableView.updateHeaderViewFrame()\n```\n\n2. (If you want to handle device rotation) In viewWillTransition(to size: with coordinator:)\n```swift\noverride func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {\n    super.viewWillTransition(to: size, with: coordinator)\n\n    // 3. Update layout every time device is rotated.\n    DispatchQueue.main.async {\n        self.tableView.updateHeaderViewFrame()\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faunnnn%2Ftableheaderviewwithautolayout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faunnnn%2Ftableheaderviewwithautolayout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faunnnn%2Ftableheaderviewwithautolayout/lists"}