Grouped UITableview remove outer separator line
I just worked out a solution, as the cell has contentView
which is a UIView
, so I think you can just focus on the bottomline of contentView
.
Here is my code:
first, you have to make the separator to clear
tableView.separatorColor = UIColor.clear
Second, in the cellForRowAt
function:
let bottomBorder = CALayer()
bottomBorder.frame = CGRect(x: 0.0, y: 43.0, width: cell.contentView.frame.size.width, height: 1.0)
bottomBorder.backgroundColor = UIColor(white: 0.8, alpha: 1.0).cgColor
cell.contentView.layer.addSublayer(bottomBorder)
here you will see the UI like this:
How to remove UITableView section header separator
Don't know why you are returning UITableViewCell
in viewForHeaderInSection
method so may be it is possible that is showing separator of that UITableViewCell
. Try returning the contentView
of cell instead of cell from viewForHeaderInSection
method.
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let cell = tableView.dequeueReusableCell(withIdentifier: "headerTableViewCell")
return cell.contentView
}
Remove Separator from Grouped UItableview
Thanks All,
Have solved this by setting Bottom Constraint of the view to -1, and unchecked Clip To Bounds for both UITableViewCell and its Content View.
How to remove section header separator in iOS 15
Option 1:
Maybe by using UITableViewCellSeparatorStyleNone
with the table view and replacing the system background view of the cell with a custom view which only features a bottom line?
Option 2: Using hint from https://developer.apple.com/forums/thread/684706
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000 // only Xcode 13+ needs and can compile this
if (@available(iOS 15.0, *)) {
[self.tableview setSectionHeaderTopPadding:0.0f];
}
#endif
}
Remove single separator line from UITableViewCell
The easiest way is: don't use built-in separator lines. Draw the line yourself (as part of the cell) in each row where you want one, and don't draw it (i.e. remove it) in each row where you don't want it.
Remove first line separator of UItableView Cell
Within your cellForRowAt
delegate function you can use:
if indexPath.row == 0 {
cell?.separatorInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: .greatestFiniteMagnitude)
}
Related Topics
Animating/Moving Views Under Usage of Autolayout
Avcapturesession Audio Doesn't Work for Long Videos
Nsinternalinconsistencyexception, Reason: Could Not Load Nib in Bundle
Swift - Compressing Video Files
Create PDF with Multiple Pages
Firebase Chat Push Notifications
Storyboard Segues Causing Memory Leaks
Uitextfield -Webview No Longer Supported
Fbsdkloginmanager Loginwithpublishpermissions Always Returns Iscancelled=Yes
Split View Controller Must Be Root View Controller
Storing Uicolor Object in Core Data
Hide Device Volume Hud View While Adjusitng Volume with Mpvolumeview Slider
Code Signing Error: Application Failed Codesign Verification
Multiple Locations on Map (Using Mkmapitem and Clgeocoder)
How to Log in with Sandbox Test Users on Device
@Published Property Wrapper Not Working on Subclass of Observableobject