UITableView separator line not closed - uitableview

all
I am doing some jobs using UITableView, But I don't know how to make the UITableView's separator line closed, some blank in front of the cell.
In other words, the line width is not the whole screen width, Is this new feature in iOS7 or iOS8? How can I set the separator line closed, like customized table cell.
I tried the UITableViewCellSeparatorStyleSingleLine, not any effect.
Thanks a lot.

Related

IOS last tableViewCell separator is missing

I have tableView with multiple cells (without sections).
I add non-empty tableFooterView to the tableView. After that the last cell separator is not shown. Also when tableView is scrolled, separator sometimes appears or disappears. It happens both on simulator and on the device.
I've checked Debug view hierarchy and found the following:
It is very strange. Penultimate cell separator is duplicated there but the last separator is single. May be the problem is somewhere there?
I've also checked it's properties:
All I found as solution is to add empty tableFooterView but I need it to be filled.
How to make the last separator be always visible (also when scrolling)?
I know you can get away without using actual separators, but adding one pixel line in the bottom of the cell. But I'm not a fan of this approach.

White background at the top of UITableView [duplicate]

This question already has answers here:
Empty white space above UITableView inside a UIView
(9 answers)
Closed 5 years ago.
I have a UITableView below a UITextField. Strangely, the upper part of the UITableView has a white background. The tableView scrolls nicely till just below the UITextField, so it is being placed correctly below it. It is just that the upper portion is somehow getting a white background. And this portion seems to scale with respect to the height of the UITextField. i.e. if I increase the height of the textField, the white portion will increase too.
I have tried setting the adjust scroll view insets to false but to no avail.
layout and its constraints are looking fine, I think you might have added a header view in code. Can you check your delegate and data source functions in your class.
Go to storyboard and select view controller where your tableview is and
Unmark option Adjust ScrollView Insets
By default an section height and footer of 28 is added to the tableview in xib.
Change it 1 for both header and footer in the size inspector.

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.

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.

UILabel in UITableViewCell Getting Drawn Over Accidentally

I'm using a prototype cell inside a grouped UITableView to create custom cells with two UILabels inside. Each UILabel is populated with text. The first UILabel, alligned on the left of the cell, behaves appropriately.
However, the second UILabel, which is toward the middle of the cell, is somehow being drawn behind the cell's background! I can't explain why, but if I set the background color of the cell to be clearColor instead of the default, the 2nd Label can be seen and works just fine. It also shows up if I highlight the cell, but disappears again when unhighlighted. I am sure that the label isn't just "blending in" with the background; the background is white and the label is black.
Any ideas? I'm a bit stumped. Is there some sort of issue with prototype cells and having more than one label?
Edit: Answered my own question, see below.
Okay, this has been resolved!
So like I said, I was setting up prototype cells in interface builder with two UILabels. To access these UILabels in my cellForRowAtIndexPath delegate method for my UITableView, I was using the Label's Tags. The first label I had tagged as "1", and the second label tagged as "3" (don't ask why it is 3 and not 2). Anyway though, it turns out that UITableViewCells already have a label with special properties setup with tag 1. Besides the label with tag 1 hiding my 2nd label, it was also remaining centered in the cell when I was changing cell size dynamically (when I wanted it to stay at the top).
Long story short: UITableViewCells have a "special" label already built in with tag of 1, so I changed my first label's tag to 10 and everything went back to behaving as I would expect.

Resources