![](/img/trans.png)
[英]Why is the segue executing even though the wrapping conditional is not met?
[英]Segue performs even though identifier is not met
我已經使用樣式推送將一個uibutton從uibutton創建到viewController。 我只希望在符合條件的情況下推動此任務。 為此,我創建了這樣的標識符:
[self performSegueWithIdentifier:@"LoginSuccessful1" sender:self];
但是,即使尚未調用performSegueWithIdentifier,似乎segue仍在被推送。 我怎樣才能解決這個問題?
與其直接從按鈕中選擇按鈕,不如將UIButton掛接到視圖控制器上的IBAction上。 然后,在此IBAction中,檢查條件並調用performPergue。 直接從按鈕上掛接Segue時,不首先使用ViewController。
從按鈕中刪除segue
,然后將其從ViewController
連接到AnotherViewController
作為pushsegue
而不是從UIButton
並檢查條件並執行segue
if(this == that){
[self performSegueWithIdentifier:@"LoginSuccessful1" sender:self];
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.