0
빠른 프로그래밍에서 초를 시작할 때 첫 번째보기 컨트롤러의 애니메이션을 중지하는 방법. 첫 번째보기 컨트롤러에서 애니메이션을 중지하는 함수를 만들었습니다. 두 번째 뷰 컨트롤러에서 호출되도록하고 싶습니다. 첫 번째보기 컨트롤러에서초를 시작할 때 첫 번째보기 컨트롤러의 애니메이션 중지 빠른 프로그래밍
func stopAni(){
self.resultView.stopAnimating()
ButtonAudioPlayer.stop()
ButtonAudioPlayer1.stop()
ButtonAudioPlayer2.stop()
ButtonAudioPlayer3.stop()
ButtonAudioPlayer4.stop()
ButtonAudioPlayer5.stop()
ButtonAudioPlayer6.stop()
초 뷰 컨트롤러에서이 함수를 호출하는 방법을 잘하지 않습니다. 당신이 할 수있는, 두 번째 뷰 컨트롤러에서
class FirstViewController : UIViewController, StopAnimationDelegate{
//..... here code
func stopAnimations(){
//Stop your animations or call your method stopAni here.
}
//.... here more code
@IBAction func openSecondViewController(sender:UIButton){
self.performSegueWithIdentifier("segue_first_second",sender:nil)
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "segue_first_second"{
let secondViewController = segue.destinationViewController as! SecondViewController
secondViewController.delegate = self
}
}
}
:
protocol StopAnimationDelegate{
func stopAnimations()
}
그런 다음, 첫 번째 뷰 컨트롤러에이 프로토콜을 채택 할 겁니다 :
난 당신에 의해 제안 신속한 코드를 사용하지만입니다 작동 안함! @ José Roberto Abreu – John
@John 샘플 프로젝트를 업로드하여 업로드 할 수 있습니까? –