如何解决PopUpDialog cocoapod自定义按钮不起作用
我在我的应用程序https://cocoapods.org/pods/PopupDialog中使用了这个PopUpDialog cocoapod
我已经制作了一个自定义VC,并且希望我的两个按钮在单击时增加/减少FurnitureLabel上显示的数字(标签在按钮上方的弹出对话框中)。 这是我的弹出窗口的样子:
我不知道我缺少什么,但是当我创建两个按钮时,我都收到了这个错误消息:表达类型不明确,没有更多上下文。
它显示在该行的旁边:
furnitureVC.furnitureLabel.text = String(Int(furnitureVC.furnitureLabel.text) - 1)
您能否更正我的代码才能正常工作?
func handleForward(animated: Bool = true) {
//Create a custom view controller
let furnitureVC = FurniturePopUp(nibName: "FurniturePopUp",bundle: nil)
//Create the dialog
var popup = PopupDialog(viewController: furnitureVC,buttonAlignment: .horizontal,transitionStyle: .bounceDown,tapGestureDismissal: true,panGestureDismissal: false)
let vc = popup.viewController as! PopupDialogDefaultViewController
// Set dialog properties
vc.titleText = "..."
vc.messageText = "0"
// Create first button
let buttonOne = DefaultButton(title: "Decrease",height: 60,dismissOnTap: false) {
furnitureVC.furnitureLabel.text = String(Int(furnitureVC.furnitureLabel.text) - 1)
vc.messageText = furnitureVC.furnitureLabel.text
}
// Create second button
let buttonTwo = DefaultButton(title: "Increase",dismissOnTap: false) {
furnitureVC.furnitureLabel.text = String(Int(furnitureVC.furnitureLabel.text) + 1)
}
buttonOne.setImage(#imageLiteral(resourceName: "minus").withRenderingMode(.alwaysOriginal),for: .normal)
buttonTwo.setImage(#imageLiteral(resourceName: "plus").withRenderingMode(.alwaysOriginal),for: .normal)
// Add buttons to dialog
popup.addButtons([buttonOne,buttonTwo])
// Present dialog
present(popup,animated: animated,completion: nil)
}
FurniturePopUp:
class FurniturePopUp: UIViewController {
@IBOutlet weak var decreaseButton: UIButton!
@IBOutlet weak var increaseButton: UIButton!
@IBOutlet weak var furnitureLabel: UILabel!
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。