UIView上的控制項使用push方法跳轉,uiviewpush

來源:互聯網
上載者:User

UIView上的控制項使用push方法跳轉,uiviewpush

有時候在項目中,為了保持前後頁面的推進方式跳轉方式一致,會在通過UIview上的控制項跳到另一個Controller上,所以,這時候就需要用到這種方式了,當然,present方法可以實現跳轉但是樣式可能不同,這時候在我的想法可以使用代理或者回調,當你不熟悉時,就用到了這個方法:

1.參考別人的方法:   http://gekie.iteye.com/blog/1133460

2.使用響應者鏈的方法。。。

  1> 假定你的項目中有檔案 UIViewContronllerA, UIViewContronllerB,UIView;我們的UIview是UIViewContronllerA中封裝的一個view,並且,我們需要通過UIview上的一個事件來跳轉到UIViewContronllerB(跳轉方法在UIview頁面中)

  2>首先,我們在UIView.h頁面聲明一個屬性  @property (nonatomic,strong) UIViewController *owner;

      然後,在UIView.m頁面的需要跳轉的事件裡面調用跳轉方法:  [self.owner.navigationController  pushViewController:[UIViewContronller2 new] animated:YES];

  3>最後,別忘了,在UIViewContronllerA控制器中調用這個UIVIew: 

     UIView *view = [[UIView alloc] init];

     view.owner = self;

OK!這樣你就能實現在view上面跳轉了。。。。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.