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

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.

Related

SearchBar's UITextField paddings?

I use UISearchBar inside of UITableView. And I need to set custom left and right margins of UITextField.
Marked with red line on the picture.
Xamarin or Swift example could be applied.
Usually, when you want to add a searchbar to table you do it this way:
Choose a UIViewController instead of UITableViewController.
Add a UISearchBar on top.
Add UITableView below.
Set search bar to fixed height via constraints in Interface Builder.
Set the search bar's left & right constraints you want. (In your situation it would probably be something like 20px to right)
However it's also possible to use search bar the way, you've implemented it.
If you've used section header for a search bar, then you can add those constraints programmatically. Set them in willDisplayHeaderView method. That's a more complicated approach though.
Personally, I would rather go with first approach since it's much easier to set constraints in IB rather than programmatically.
If you want to add padding around the text inside the textfield this is how.
The image however shows the red line outside the the textfield, I would nest the UITextField inside a view and add the inset to that view.

iOS) How to add default separator of uitableviewcell

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.

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.

How to remove separator in between subclassed UITableViewCells?

I have subclassed UITableViewCell. This class is linked to the following xib, which is just a UITableViewCell with a label inside of it:
If you look closely at the bottom, you can see the divider there. How can I remove this?
Here's what the cells look like in a table view:
edit: My table view controller is a subclass of PFQueryTableViewController from the parse.com service. My apologies for neglecting to mention this.
edit2: I changed the colors of the separators to red and have discovered some very off behavior that might aid in figuring out why this isn't working. There seems to be some spacer on the far left of each divider:
Try to make it from the xib :
Go to xib
select table
make separator None.
You can do this with the UITableView property separatorStyle. Make sure the property is set to UITableViewCellSeparatorStyleNone and you should be good to go.
Set table separator style to none from design or code
It simple.. just Go to the Xib File where you have put the UITableView and right side in the attribute inspector you will find Seperator Option.. just select None in that
OR
You can do it manually with the code
tableview.separatorStyle = UITableViewCellSeparatorStyleNone;
just write this in your viewDidLoad method and it will be done..
Found the problem. When I had adjusted the height of the table view cell to 125 over the usual 44, i had adjusted the height of the view sitting inside of the table view cell, instead of the actual view cell.
Thanks for the help anyways to everyone who provided suggestions.

What are these UITableView lines in the image?

I have a UITableView on a UIView. This UIView is in a UICollectionViewCell which means that I can do the action you can see in the image. A new UICollectionViewCell is coming on from the right. As a new cell comes onto the visible rect it is slightly resized you can see that the right one is slightly smaller.
While this new cell is "sliding on" the table view has some black lines that show through. It is not the actual separator lines as you can clearly see them, further turning them off or making them the same colour as the cell does not change things.
So can anyone tell me what these black lines are and if I can either directly get rid of them or cover them over somehow.
I believe that the lines are cell separators. You could set the separatorStyle property to UITableViewCellSeparatorStyleNone.
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

Resources