如何快速解决“无法识别的选择器已发送”错误?

时间:2019-06-10 08:25:41

标签: swift

我有两个文本字段,其中一个是datePicker输入视图,另一个是普通文本。当我从普通文本字段移至datePicker textfield时,应用程序崩溃了。如何解决这个问题

func textFieldDidBeginEditing(_ textField: UITextField) {
        animateViewMoving(up: true, moveValue: 150)
    }
    func textFieldDidEndEditing(_ textField: UITextField) {
        animateViewMoving(up: false, moveValue: 150)
    }
    // Move the text field in a pretty animation!
    func animateViewMoving (up:Bool, moveValue :CGFloat){
        let movementDuration:TimeInterval = 0.3
        let movement:CGFloat = ( up ? -moveValue : moveValue)
        UIView.beginAnimations( "animateView", context: nil)
        UIView.setAnimationBeginsFromCurrentState(true)
        UIView.setAnimationDuration(movementDuration )
        self.view.frame = self.view.frame.offsetBy(dx: 0, dy: movement)
        UIView.commitAnimations()
    }

0 个答案:

没有答案