I'm new to iOS dev and I want to have spacing between certain cells like the official settings app has.
Is there a way to do this in one TableView or do I have to insert more of them?
If I have more TableViews the screen is not fully scrollable and maybe not all of them are able to show.
To achieve a TableView
that looks like the one in the settings you have to set the Style
of your TableView
to Grouped
and use Sections
for separating/grouping a certain set of TableViewCells
.
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return myNumberOfRows
}
func numberOfSections(in tableView: UITableView) -> Int {
return myNumberOfSections
}
For more info about numberOfSections
have a look at the UITableViewDataSource delegate.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With