Reputation: 4302
How can I remove a separator line of a single row in a Eureka Form?
I would like to remove the last line in the tableview, the one underneath the description row. When I looked around for a solution for this problem with a regular tableview, the most popular solution is to push the separator line of a specific cell out of the screen by setting a large separator inset. Like this:
form.last! <<< TextAreaRow("description row") {
$0.placeholder = "Description of the issue"
$0.textAreaHeight = .dynamic(initialTextViewHeight: 44)
}.cellSetup{ cell, row in
cell.separatorInset = UIEdgeInsets(top: 0, left: 2000, bottom: 0, right: 0)
}.onChange{ [weak self] in
self?.issueMessage = $0.value ?? ""
}
I'm calling this on viewDidLoad
, but it doesn't seem to have any effect. I'm new to Eureka.
Upvotes: 1
Views: 1842
Reputation: 2739
Swift 4, 5
in layoutSubview
public override func layoutSubviews() {
super.layoutSubviews()
for view in self.subviews where view != self.contentView {
if NSStringFromClass(type(of: view)).contains("_UITableViewCellSeparatorView")
view.removeFromSuperview()
}
}
}
Upvotes: 0
Reputation: 2294
Try this code:
form.last! <<< TextAreaRow("description row") {
$0.placeholder = "Description of the issue"
$0.textAreaHeight = .dynamic(initialTextViewHeight: 44)
}.cellSetup{ (cell, row) in
if(row != 3) {
cell.separatorInset = UIEdgeInsets(top: 0, left: 2000, bottom: 0, right: 0)
}
}.onChange{ [weak self] in
self?.issueMessage = $0.value ?? ""
}
I added check (row != 3) by considering you have 4 rows only and index of 4th will be 3 as it starts with 0.
Upvotes: 0