所以基本上我有一个带有预订按钮的预订页面。单击该按钮会弹出一个弹出窗口,并显示一些有关预订的信息。在弹出菜单中有两个按钮“取消”和“确认”。我实现了两者的相同代码都出了问题。我删除了代码以查看结果,没有任何暗示。其中一个无缘无故地重新打开了弹出窗口。
@IBAction func confirmTappedonPopUp(sender: AnyObject) {
}
@IBAction func cancelTappedonPopUp(sender: AnyObject) {
}
@IBAction func reserveTapped(sender: AnyObject) {
//If there are missing data from user display alert message
if( selectedBoat==nil || selectedHour == nil ) {
displayAlertMessage("All fields are required!");
return;
}
animateIn()
}
func animateIn() {
self.view.addSubview(reservationPopUpView)
reservationPopUpView.center = self.view.center
reservationPopUpView.transform = CGAffineTransformMakeScale(1.3, 1.3)
reservationPopUpView.alpha = 0
popUpDateLabel.text = selectedDate
popUpTimeLabel.text = selectedHour
popUpBoatTypeLabel.text = selectedBoat
UIView.animateWithDuration(0.4, animations: {
self.reservationPopUpView.alpha = 1
self.reservationPopUpView.transform = CGAffineTransformIdentity
})
}