I'm defining a segmented control inside of a UITableViewDelegate's tableView(_:viewForHeaderInSection:)
. Since I'm using UITableView.Style.plain
, when the table scrolls, the header with the segmented control stays in a fixed position.
I'd like to create some context so that the background of the unselected segmented control blurs the table that is scrolling behind it. Here is what an ios 13 segmented control looks like:
Is there a way to blur the background of a segmented control's unselected segments?
I'm able to created a segmented control like this
let items = ["First", "Second"]
let customSC = UISegmentedControl(items: items)
customSC.selectedSegmentIndex = 0
And I'm able to create a blur with this https://stackoverflow.com/a/25706250/784637
let blurEffect = UIBlurEffect(style: .dark)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
//always fill the view
blurEffectView.frame = self.view.bounds
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
But I don't know how to bring everything together