iOS) How to add default separator of uitableviewcell - ios

Defaultly, it provides default separator between cells not for the first and last cell.
So first cell has no upper separator and last cell has no footer separator.
I need default one, not to make as UIView...
Is there any way to solve this problem?

If you don't want to create a custom border you can add a 'Dummy' cell of height 1. That will get you the default border.

You could do this putting small header and footer on your tableview.
You can create those with custom cells in your storyboard.

Related

Remove separator line of table view cell on storyboard

When I drag and drop a Table View Cell to my UITableView on storyboard, it looks like this:
I would like to remove the separator line, I try to find from attribute inspector to remove separator line:
But I can't find any option for that. Is there a way to remove separator line of a table view cell in storyboard? (I am using xcode 9.1)
Please select the TableView and not the tableView Cell in the storyBoard. The option is there to set the separator style to none there.
Before Image
After Image
Hope this helps.
Md. Ibrahim Hassan answer work until Xcode 13. And if you need to add separator for some cell, I recommend to draw by using UIView with height 1px.

The separator of the last tableViewCell will not be displayed when the UITableView is added to the footerView

The separator of the last tableViewCell will not be displayed when the UITableView is added to the footerView.How can I make it be displayed?
enter image description here
I believe you have no other choice than making a custom UICollectionViewCell and manually add the separator inside as an UIView.
This is rather straightforward if you're using a storyboard as you can directly design your prototype cell inside.

Trying to hide UITableViewCell separator by using insets but it only decreases in opacity

I am trying to hide a UITableViewCell's separator by pushing it all the way to the right as far as it goes. So I set both the cell's separator inset and layout margins all the way to the right as far as they go. But this only makes the cell slightly more transparent. As you see in the picture, the lower line is slightly more transparent than the one above. There seems to be another line for the cell below the one I hide that I can't remove for some reason. No idea what could be causing this.
You can hide the separators by calling table.separatorStyle = .None on your UITableView.
Edit 2: I couldn't tell by the question that the goal was to remove cell separators for just one type of cell: as mentioned in my comment below, I'd advise removing the separators with the line above and adding a small-height UIView as a custom separator where you want it.
Hide tableview seperator simply by setting its property in attribute inspector.
Simply select the Attributes inspector and set seperator = none if you want to hide then otherwise if you want to do any operation with seperator color then set color on there.
UITabieViewCell generally contain two subviews: content view and separator line. If a cell's height is 44.f, content view's height is 43.f and 1.f for the line. You just move the line away, but the height of it is still there.

ios tableView clearColor seperator

I have set my tableView's background color, and I want there is space(10px) around each cell show that color.
e.g.(ignore the red line)
What I am doing now is make the cell embed a smaller view, and set the cell's background to be clear. But it is annoying to create such embed view again and again.
So, I am seeking for a better solution, I believe it would be good if i can increase separator's height. But the old answers did not solve my problem.
(How to increase the UITableView separator height?)
EDIT:
However, if I add my own separator in cell. I may not able to set the cell having round corner
Set the tableView's separatorStyle to .None.
Create a custom UITableViewCell subclass.
In the storyboard (or xib if you created one for the custom cell), add a subview that's inset the amount that you want padded on all four sides.
If you want rounded views, do that on the custom cell's subview (e.g. subview.layer.cornerRadius = 10.0, subview.layer.masksToBounds = true).
Set the custom cell's ContentView to have a clear background.
Set the table view's background to that lovely shade of blue.
Set the cell subview's background color to white.
You don't have to use the cell repeatedly in InterfaceBuilder. Just give the cell an ID, and in your implementation of the table view's data source, dequeue a cell instance using that ID and set the values of the labels inside it.
Have you thought of just making the cell height taller and putting your own separator on the bottom of your custom cells? Nice table layout by the way.

Need assistance regarding custom UITableView and custom UITableViewCell

This is screenshot of whatsapp, I have to create a tableview just like this one.
It has space on left side (Dont know top two cell are custom or default with right detail style).
Few cells in between have no separators.
How I am suppose to do same with my uitableview.
Start from iOS 7 left inset of UITalbeViewCell is default. Default value is 15, but you can change it.
This is not a few cells. This is One custom cell. I mean work+main+iPhone it is one cell.

Resources