xmartlabs / Eureka

Elegant iOS form builder in Swift
https://eurekacommunity.github.io
MIT License
11.78k stars 1.33k forks source link

Any way to resize height of SegmentedRow (clickable zone, not only the view) #2158

Closed Rayhko closed 3 years ago

Rayhko commented 3 years ago

Hello, I am trying to increase the height of the buttons of a SegmentedRow. I managed to do it with a code similar to this one:

<<< SegmentedRow<String>("persist_row"){
    $0.title = "Persist"
    $0.options = ["true", "false"]
}.cellSetup { cell, _ in
    cell.segmentedControl.widthAnchor.constraint(equalToConstant: 200).isActive = true
}

However, it only increases the height visually and not the clickable area which remains very small.

Does anyone have an idea for a solution please?

Rayhko commented 3 years ago

Finally found a solution, i use constraints with visual format like this :

dynamicConstraints = NSLayoutConstraint.constraints(withVisualFormat: "V:|-[segmentedControl(80)]|", options: .alignAllCenterY, metrics: nil, views: views)
        contentView.addConstraints(dynamicConstraints)
onuryurtturk commented 3 years ago

@Rayhko can you share more detail? how?