Предварительный просмотр нежелательной кнопки перед анимацией при переходе на второй контроллер - PullRequest
0 голосов
/ 24 ноября 2018

Во встроенном проекте контроллера навигации, использующем анимацию, я не могу избежать «быстрого предварительного просмотра» кнопок, присутствующих в следующем ViewController, где эти кнопки будут скользить от левой границы экрана к центру.

Итак, когда я нажимаю на первый VC, на мгновение вижу кнопки во втором VC, а затем появляется второй VC, и анимация работает (и работает нормально)

В домашнем контроллере кнопка:

   @objc func imageTapped(tapGestureRecognizer: UITapGestureRecognizer)
    {
        print("tapped")

        //animate 1/2
        UIView.animate(withDuration: 0.8, animations: { () -> Void in
            self.mainButtonContainerView.center.y -= self.view.bounds.width //self.view.frame.origin
            self.mainButtonContainerView.isUserInteractionEnabled = false
            self.mainButtonContainerView.alpha = 0.0
        })

        //animate2/2


  DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(1) ) {
        self.pushShowNextVC_ChoiceVC(dataToPass: "")

    }

}

Тогда анимация во втором VC ViewDidLoad выглядит так:

    for singleView in coantinersOutCollection {
        //animation
        singleView.center.x -= self.view.bounds.width
        singleView.layer.cornerRadius = singleView.bounds.size.height/2
        singleView.backgroundColor = UIColor.white
        singleView.layer.borderColor = Constants.skyBlue3Color.cgColor
        singleView.layer.borderWidth = 1
    }

    for singleLabel in labesForButtons {

        singleLabel.textColor = Constants.skyBlue3Color
        singleLabel.font = UIFont.boldSystemFont(ofSize: 17.0)

    }

    for singleImage in self.iconButtonImages {

//            singleImage.image = UIImage(named: "")
            singleImage.backgroundColor = UIColor.clear
            singleImage.layer.borderWidth = 1
            singleImage.layer.borderColor = Constants.skyBlue3Color.cgColor


    }


    UIView.animate(withDuration: 1.5, delay: 0.6,
                   usingSpringWithDamping: 0.6,
                   initialSpringVelocity: 1,
                   options: [], animations: {

                    self.containerDownloadButton.center.x += self.view.bounds.width

    }, completion: nil)

    UIView.animate(withDuration: 1.5, delay: 0.7,
                   usingSpringWithDamping: 0.6,
                   initialSpringVelocity: 1,
                   options: [], animations: {

                    self.containerUploadButton.center.x += self.view.bounds.width

    }, completion: nil)

    UIView.animate(withDuration: 1.5, delay: 0.8,
                   usingSpringWithDamping: 0.6,
                   initialSpringVelocity: 1,
                   options: [], animations: {

                    self.containerCallButton.center.x += self.view.bounds.width

    }, completion: nil)

    UIView.animate(withDuration: 1.5, delay: 0.9,
                   usingSpringWithDamping: 0.6,
                   initialSpringVelocity: 1,
                   options: [], animations: {

                    self.containerIdleButton.center.x += self.view.bounds.width

    }, completion: nil)
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...