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.
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
xcode 8 swift 3 UItableview space between cells?
Make Tablview BG colour white and set BG View colour in cell that you want to keep see in image i have set bgview BG colour is light greay and make BGview hight smaller then cell i mean if you want to set space 10 pixel keep Bg hight smaller then cell 10 pixel
Here is my cell
And here is out put
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
}
Related Topics
Get Search Bar in Navigation Bar in Swift
Getting Device Id or MAC Address in iOS
How to Check If iOS App Is in Background
How to Debug "Invalid Bundle" Error Which Happens Only After Submitting to App Store
Multiline Uilabel with Adjustsfontsizetofitwidth
How to Keep an Iphone/iPad Web App in Full Screen Mode
How to Hide/Show Tabbar When Tapped Using Swift in iOS8
Our App Crashed in iOS 9 Which Upload by Xcode 10
Can't Set Headers on My Wkwebview Post Request
Avcapturevideopreviewlayer Orientation - Need Landscape
How to Check If iOS App Is in Background
Show Search Bar in Navigation Bar Without Scrolling on iOS 11
iOS Autolayout Vertically Equal Space to Fill Parent View
Change the Font Size of Uisearchbar
Setting Contentoffset Programmatically Triggers Scrollviewdidscroll