How to add spacing between UITableViewCells - Swift
I tried ozgur's method but it didn't work because I had borders between my table view cells. Eventually, I used the answer from this post. Hope it helps
How to set space between tableView Cells?
Better approach is the most simple way that make your cells height a bit bigger(3pt from top and 7pt from the bottom) than that of your cell's Total height, and making the colour as [UIColor clearColor]. That would give the illusion that the cells have a 10 pt gap in between.
OR
Add UIView()
of 10 height at the end and give it clear color it show space between two cells
How do I add spacing between two cells in UITableView? There's nothing like separator height or something
One option is to use sections and section footers:
override func numberOfSections(in tableView: UITableView) -> Int {
return 5
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
// your spacing
return 20
}
override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let footer = UIView()
footer.backgroundColor = .clear
footer.isOpaque = false
return footer
}
Can I give space between UITableViewCell
The most simple way would be make your cells height a bit bigger(3pt from top and 7pt from the bottom) than that of your cell's background image, and making the colour as [UIColor clearColor]
. That would give the illusion that the cells have a 10 pt gap in between.
Related Topics
Swift Png Image Being Saved With Incorrect Orientation
Nsoperation VS Grand Central Dispatch
Enterprise App Deployment Doesn't Work on iOS 7.1
Set Padding For Uitextfield With Uitextborderstylenone
Submit to App Store Issues: Unsupported Architecture X86
How to Customize the Background/Border Colors of a Grouped Table View Cell
How to Opt-Out of Dark Mode on iOS 13
How to Save Picture to Iphone Photo Library
Uiview Infinite 360 Degree Rotation Animation
Adding Space/Padding to a Uilabel
Registering For Push Notifications in Xcode 8/Swift 3.0
Wkwebview Not Loading Local Files Under iOS 8
Duplicate Symbols For Architecture X86_64 Under Xcode
How to Enable File Sharing For My App
How to Have Stored Properties in Swift, the Same Way I Had on Objective-C
How to Preserve Identifierforvendor in iOS After Uninstalling iOS App on Device