Reputation: 81
Hi :) I'm having a tableView and I want to have a tableView inside my UITableViewCell, now I was thinking to create a custom tableView inside UIView class and then present it inside the UITableViewCell using UIView, I'm wondering is it possible or I'm approaching the problem wrong :)
Here's a picture of what I would like to achieve: Link
Upvotes: 0
Views: 691
Reputation: 796
Although you CAN add a UITableView
to any UIView
, that means also to a UITableViewCell
, what you are trying to achieve looks like a UITableView
with UITableView.Style.insetGrouped
.
This new style for table views is available at iOS13.
Just initialize your table view with this style, e.g.:
let tableView = UITableView(frame: .zero, style: .insetGrouped)
You can see the documentation here: (https://developer.apple.com/documentation/uikit/uitableview/style/insetgrouped)
In this thread, there is the screenshot of this UITableView.Style
:
TableView with inset grouped style: Have rounded corners even with hidden cells
Upvotes: 1
Reputation: 1044
You can achieve that kind of look by using inset grouped style on UITableView and by adding sections to UITableView
Upvotes: 0