TOInsetGroupedTableView is a subclass of
UITableView that back-ports the new "inset grouped" visual style introduced in iOS 13 to older versions of iOS.
On iOS 13 and above, it defers back to using the system implementation, meaning absolutely no extra configuration code is required.
This library is fantastic for developers adopting the new rounded corners style of table views in their apps, but are still supporting iOS 11 or iOS 12.
TOInsetGroupedTableViewfolder to your own Xcode project.
In your app's Podfile, add:
TOInsetGroupedTableView is extremely simple as it introduces no new APIs or changes any external inputs. All that is needed is to replace
UITableView() instantiations with
In Swift, the class is renamed to
InsetGroupedTableView. In order to integrate it, simply replace any instances of
self.tableView = UITableView(frame: .zero, style: .insetGrouped)
self.tableView = InsetGroupedTableView(frame: .zero)
No other changes are needed.
Just like in Swift, all that is required is to rename any instantiations of
For example, simply replace any instances of:
self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleInsetGrouped];
self.tableView = [[TOInsetGroupedTableView alloc] initWithFrame:CGRectZero];
TOInsetGroupedTableView was created by Tim Oliver.
TORoundedTableView is a library with a similar goal: replicating the rounded corner table view style that has been present in Settings.app since iOS 7.
TORoundedTableView was originally released in late 2016 with the explicit goal of supporting iOS versions 8.0 and above.
Due to the APIs available on iOS at the time, as well as the relative graphics performance of the hardware of that era,
TORoundedTableView required far more modification of
UITableView and its components to achieve the effect, and maintain high FPS.
Most notably, in order to have the rounded caps on the cells, it was also necessary to create subclasses of
UITableViewCell as well, which increased the complexity of the implementation, and meant it couldn't really be simply 'dropped in' to existing implementations.
By focusing on just the most recent iOS versions, where OpenGL has been completely removed, and there are now more Core Animation APIs,
TOInsetGroupedTableView is able to achieve the same effect as
TORoundedTableView but without needing to subclass any of the cells.
Additionally, by observing how
.insetGrouped behaves in iOS 13, it was also possible to configure
TOInsetGroupedTableView to work alongside it, allowing for the same code to default back to the iOS 13 implementation when possible.
TOInsetGroupedTableView is available under the MIT license. Please see the LICENSE file for more information.
|Last commit: 1 week ago|