问题描述
我在我的应用程序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 (将#修改为@)