如何对 ios.On 中的按钮产生影响 单击该按钮它应该展开

how to make effects on button in ios.On clicking on that button it should expand

我想在 button.If 上应用效果,单击该按钮,它的大小应该会增加,其他的应该保持原来的大小 size.In 如果单击 jardine,它应该会展开下图。

下面是动画和转换按钮的代码。 它 运行 完全符合你

的相位
func changeButtons(selectedButton:UIButton)
{
    firstBtn.backgroundColor = .white
    firstBtn.setTitleColor(.black, for: .normal)
    animateButton(button: firstBtn, transformBy: .identity)

    secondBtn.backgroundColor = .white
    secondBtn.setTitleColor(.black, for: .normal)
    animateButton(button: secondBtn, transformBy: .identity)

    thirdBtn.backgroundColor = .white
    thirdBtn.setTitleColor(.black, for: .normal)
    animateButton(button: thirdBtn, transformBy: .identity)

    selectedButton.backgroundColor = .black
    selectedButton.setTitleColor(.white, for: .normal)
    animateButton(button: selectedButton, transformBy: CGAffineTransform(scaleX: 1.2, y: 1.2))
}
func animateButton(button : UIButton,transformBy:CGAffineTransform)
{
    UIView.animate(withDuration: 0.2) {
        button.transform = transformBy
        self.view.layoutIfNeeded()
    }
}
@IBAction func btnFirstPress(_ sender: UIButton)
{
    changeButtons(selectedButton: firstBtn)
}
@IBAction func btnSecondPress(_ sender: UIButton)
{
    changeButtons(selectedButton: secondBtn)
}
@IBAction func btnThirdPress(_ sender: UIButton)
{
    changeButtons(selectedButton: thirdBtn)
}