2016年1月14日 星期四

iOS筆記:storyboard Unwind Segue簡單返回

這個方法可以用在UIButton,也能用在Gesture上,像這樣:





  1. 有兩個ViewController,在firstViewController中按下「GO」按鈕會到secondViewController,而secondViewController有「BACK」按鈕按下可以回到firstViewController。




  2. firstViewController加入方法,名為back。

  3. - (IBAction)back:(UIStoryboardSegue* )segue{ 
    }

  4. 回到storyboard,點一下firstViewController。
    接著在EXIT上按右鍵,把back方法跟BACK按鈕連接
  5. RUN看看吧,已經完成了
同場加映:Gesture用Unwind的方法
一樣要事先寫好方法



參考資料:iOS开发使用Unwind Segue进行返回

沒有留言:

張貼留言