Monday, October 23, 2023
HomeiOS Developmentios - Find out how to configure button through UIButton.Configuration with customized...

ios – Find out how to configure button through UIButton.Configuration with customized SFSymbol?


I create my button:

non-public let sortButton: UIButton = {
        let buttonConfig = UIButton.Configuration.plain()
        let button = UIButton(configuration: buttonConfig)
        button.tintColor = R.colour.controlSecondaryTypo()
        button.showsMenuAsPrimaryAction = true
        button.changesSelectionAsPrimaryAction = true
        return button
    }()

Subsequent I add the menu:

 non-public func setupButton() {
        let gadgets = ["New", "Old"]

        let actions: [UIAction] = gadgets.map {
            let motion = UIAction(title: $0) { motion in
                print("(motion.title)")
            }

            return motion
        }

        let menu = UIMenu(choices: .singleSelection, kids: actions)
        sortButton.menu = menu
    }

Right here is the show of my buttonenter picture description right here

It’s all the time displayed by default with chevron.up.chevron.down. How can I modify to a different SFSymbol? Instance: chevron.down

I need to have the ability to configure button that can change the title relying on the chosen UIMenu ingredient with a customized SFSymbol



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments