簡體   English   中英

使用一個BarButton推送到不同的視圖

[英]Push to different views with one BarButton

我的主窗口帶有導航欄和右上角的一個BarButton。 我有一個保存的值,並且我想推送到其他控制器,具體取決於它是TRUE還是FALSE。 現在,在IB中僅按Ctrl + Drag即可推入其中一個,但是如果我想在視圖之間進行推選,該怎么辦? 有什么建議么?

只需實現與〜UIBarButton連接的簡單IBAction

-(IBAction)barButtonPressed {
     if (yourBoolean) {
          TrueViewController *trueViewController = [[TrueViewController alloc] init];
          [self.navigationController pushViewController:trueViewController animated:YES];
     } else {
          FalseViewController *falseViewController = [[FalseViewController alloc] init];
          [self.navigationController pushViewController:falseViewController animated:YES];
     }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM