2017-07-04 5 views
0

This is how my story board currently looks私のセグエは、私は縦置きボタン付きビュー上のボタンをクリックすると

、私は戻ってくつろぐとき、私は終わるすべての道を行く、しかし、正しい対応するビューを開くことができますあまりにも遠く遡りますボタンのあるページではなく、サインインページに戻ります。私は適切な場所に巻き戻しセグを持っています、なぜそれがそれほど遠くに行くのか分かりません。

これは、ボタン

@IBOutlet weak var menuButton: UIButton! 

@IBOutlet weak var clubButton: UIButton! 

@IBOutlet weak var announcemnetsButton: UIButton! 

@IBOutlet weak var eventButton: UIButton! 

var transition = QZCircleSegue() 


override func viewDidLoad() { 
    super.viewDidLoad() 

    menuButton.layer.cornerRadius = menuButton.frame.size.width/2 
    clubButton.layer.cornerRadius = menuButton.frame.size.width/2 
    announcemnetsButton.layer.cornerRadius = menuButton.frame.size.width/2 
    eventButton.layer.cornerRadius = menuButton.frame.size.width/2 

    menuButton.layer.masksToBounds = true 
    clubButton.layer.masksToBounds = true 
    announcemnetsButton.layer.masksToBounds = true 
    eventButton.layer.masksToBounds = true 

} 
override var prefersStatusBarHidden : Bool { 
    return true; 

} 
override func prepare(for segue: UIStoryboardSegue, sender: Any?) { 
    if (segue.identifier == "NewVC") { 
     self.transition.animationChild = menuButton 
     self.transition.animationColor = UIColor(red: 255/255, green: 0/255, blue: 0/255, alpha: 1.0) 
    } else if (segue.identifier == "ClubVC") { 
     self.transition.animationChild = clubButton 
     self.transition.animationColor = UIColor(red: 81/255, green: 172/255, blue: 246/255, alpha: 1.0) 
    } else if (segue.identifier == "AnnouncementVC") { 
     self.transition.animationChild = announcemnetsButton 
     self.transition.animationColor = UIColor(red: 255/255, green: 179/255, blue: 109/255, alpha: 1.0) 
    } else if segue.identifier == "EventVC" { 
     self.transition.animationChild = eventButton 
     self.transition.animationColor = UIColor(red: 63/255, green: 255/255, blue: 176/255, alpha: 1.0) 
    } 
    let toViewController = segue.destination as! NewViewController 
    /* Set both, the origin and destination to your transition manager*/ 
    self.transition.fromViewController = self 
    self.transition.toViewController = toViewController 
    /* Add the transition manager to your transitioningDelegate View Controller*/ 
    toViewController.transitioningDelegate = transition 
} 

/* Specify the destination view controller to enable the unwind segue*/ 
@IBAction func unwindToMainViewController (sender: UIStoryboardSegue){ 
    self.dismiss(animated: true, completion: nil) 

}}

+0

あなたのコードを投稿してください。特に、ストーリーボードのビューコントローラー接続で巻き戻してください。 –

+0

私のコード –

+0

を書きました。コードは大丈夫ですが、ストーリーボードの接続が見えないと何が起こっているのかは分かりません。また、prepare()の機能を減らすことで、問題を特定することもできます。 – Totoro

答えて

1

とビューコントローラ作られたiOSのはお金で右であることをコメントするコードです。ビューコントローラにアクセスするためにセグを使用したからといって、1つだけ使用しなければならないわけではありません。ちょうど表示していたビューコントローラに戻ってみたいと思っている場合、いくつかの可能性があります。あなたがしたいことは、現在のView Controllerをスタックからポップすることです。あなたはナビゲーションコントローラ(あなたが最も可能性が高い)を使用している場合、これはそれを行う方法です:

dismiss(animated: true, completion: nil) 

以来のビューコントローラ:

self.navigationController?.dismiss(animated: true, completion: nil) 

あなたはこれにそれを簡素化することができるかもしれませんself.dismiss()メソッドがあります。試してみて、これがあなたのために働くかどうかを教えてください。

+0

答えを明確にできますか?多分、これはOPにとって理にかなっているかもしれませんが、あなたが言っていることは完全にはっきりしているとは思いません。ありがとう! –

+1

ヘッドアップありがとう!今は少しはっきりしています。 – Mozahler

+0

10億回!ありがとう、これは今完全な意味があります! –

関連する問題