{"id":23719516,"url":"https://github.com/appfigures/afdynamictablehelper","last_synced_at":"2025-09-03T21:30:29.567Z","repository":{"id":21996561,"uuid":"25321603","full_name":"appfigures/AFDynamicTableHelper","owner":"appfigures","description":"Create dynamic height table cells with auto layout in iOS \u003e= 7.0.","archived":false,"fork":false,"pushed_at":"2014-10-16T21:24:40.000Z","size":148,"stargazers_count":24,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-01T10:22:26.665Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/appfigures.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-16T21:01:33.000Z","updated_at":"2017-02-06T03:30:52.000Z","dependencies_parsed_at":"2022-08-20T04:21:47.838Z","dependency_job_id":null,"html_url":"https://github.com/appfigures/AFDynamicTableHelper","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appfigures%2FAFDynamicTableHelper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appfigures%2FAFDynamicTableHelper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appfigures%2FAFDynamicTableHelper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appfigures%2FAFDynamicTableHelper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appfigures","download_url":"https://codeload.github.com/appfigures/AFDynamicTableHelper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231918552,"owners_count":18445746,"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","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":[],"created_at":"2024-12-30T21:52:20.349Z","updated_at":"2024-12-30T21:52:20.902Z","avatar_url":"https://github.com/appfigures.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AFDynamicTableHelper\n\nCreate dynamic height table cells with auto layout in iOS \u003e= 7.0.\n\nAre you building an app that targets iOS \u003e= 7.0 and need to create table views with dynamic cell heights? This little helper takes care of all the quirks you need to do it right. On iOS 8.0 it takes advantage of the new auto-sizing capabilities automatically.\n\nIf you're only targeting 8.0+ you don't need this class. Just use the built in `UITableViewAutomaticDimension`.\n\nStill here? Read on:\n\nIf you're unfamilar with the quirks involved in implementing dynamic height table views for iOS 7 I highly recommend reading [this stackoverflow question](http://stackoverflow.com/questions/18746929/using-auto-layout-in-uitableview-for-dynamic-cell-layouts-variable-row-heights). A lot of the code for this class is based on that question.\n\n## Usage\n\nThis utility is a simple `NSObject` that provides you with concrete implementations for the deceivingly-non-trivial-to-implement:\n\n    tableView:heightForRowAtIndexPath:\n\nand\n\n    tableView:cellForRowAtIndexPath:\n\nA simple use-case looks something like this:\n\n    @implementation MyTableViewController\n    ...\n    - (void)awakeFromNib {\n        self.tableHelper = [[AFDynamicTableHelper alloc] init];\n        self.tableHelper.delegate = self;\n        self.tableHelper.reusableCellIdentifier = @\"myCell\";\n    }\n    \n    /* ... the usual tableView delegate methods... */\n    \n    // Just forward these methods over to the dynamic table helper and get on with your day.\n    \n    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {\n        return [self.tableHelper tableView:tableView cellForRowAtIndexPath:indexPath];\n    }\n    \n    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {\n        return [self.tableHelper tableView:tableView heightForRowAtIndexPath:indexPath];\n    }\n\nCheck out a complete example in the [demo project](https://github.com/appfigures/AFDynamicTableHelper/blob/master/Example/AFDynamicTableHelper/SimpleListController.m).\n\n### Customizing your cells\n\nIn order to do its magic this class needs to manage the way table cells are created and populated. The only thing it asks is that instead of setting up your cell in the usual `tableView:cellForRowAtIndexPath:` you implement the following delegate method:\n\n    - (void)dynamicTableHelper:(AFDynamicTableHelper *)tableHelper\n                   prepareCell:(UITableViewCell *)cell\n                   atIndexPath:(NSIndexPath *)indexPath\n                     tableView:(UITableView *)tableView\n                     offscreen:(BOOL)offscreen\n    {\n        // `cell` is created for you based on\n        // tableHelper.reusableCellIdentifier. You just\n        // need to populate it.\n    \n        // `offscreen` specifies if this cell will be used solely for height\n        // measurements purposes so you can avoid doing\n        // any expensive setup steps that don't affect the\n        // cell's height.\n    \n        // the `offscreen` argument is only here for optimization purposes\n        // and can be safely ignored if you don't want to deal\n        // with it.\n    }\n\n### What happens on iOS \u003e= 8.0?\n\nWhen this class detects iOS \u003e= 8.0 it does about 95% less work and just returns `UITableViewAutomaticDimension` when asked for a cell's height. The key thing is that your code doesn't need to change depending on the version of iOS. That logic is taken care of behind the scenes.\n\n### What if I use multiple cell prototypes?\n\nJust implement the delegate method `dynamicTableHelper:reusableCellIdentifierForRowAtIndexPath:tableView:`\n\n## Installation\n\nAFDynamicTableHelper is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n    pod \"AFDynamicTableHelper\"\n\n## Author\n\nOz Michaeli from appFigures\n\n## License\n\nAFDynamicTableHelper is available under the MIT license. See the LICENSE file for more info.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappfigures%2Fafdynamictablehelper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappfigures%2Fafdynamictablehelper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappfigures%2Fafdynamictablehelper/lists"}