问题描述
我的应用中有一个浮动按钮,可显示 5 个不同的按钮。它们每个都有一种颜色,但最初是灰色的。当用户选择其中一个按钮时,所有按钮都隐藏,当用户再次点击浮动按钮时,之前点击的按钮不是灰色而是具有适当的颜色。
同样的逻辑是用户可以点击另一个按钮来选择它,而前一个将被取消选择,就像用户点击一个选定的按钮一样,它被取消选择。
我将可可豆荚用于浮动按钮 JJFloatingActionButton,但文档中没有关于此的信息。
func configureActionButton() {
actionButton.overlayView.backgroundColor = UIColor(white: 0,alpha: 0.5)
actionButton.buttonImage = UIImage(systemName: "line.horizontal.3.decrease")
actionButton.buttonColor = UIColor(named: "signoColor")!
actionButton.buttonImageColor = .white
actionButton.buttonImageSize = CGSize(width: 30,height: 30)
actionButton.itemAnimationConfiguration = .slideIn(withInterItemSpacing: 14)
actionButton.itemSizeRatio = CGFloat(0.75)
let item = actionButton.addItem()
item.titleLabel.text = "Button 1"
item.buttonColor = UIColor(red: 254/255.0,green: 224/255.0,blue: 255/255.0,alpha: 1.0)
item.buttonImageColor = UIColor(red: 200/255.0,green: 73/255.0,blue: 203/255.0,alpha: 1.0)
item.imageSize = CGSize(width: 30,height: 30)
item.action = { item in
//This is for the functionality of the button
}
let item2 = actionButton.addItem()
item2.titleLabel.text = "Button 2"
item2.buttonColor = UIColor(red: 254/255.0,alpha: 1.0)
item2.buttonImageColor = UIColor(red: 200/255.0,alpha: 1.0)
item2.imageSize = CGSize(width: 30,height: 30)
item2.action = { item in
//This is for the functionality of the button
}
//And I have 3 more buttons
}
我希望得到一些帮助。我搜索了类似的问题,但没有一个解决了这个问题。谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)