UIView上的按鈕跳轉到一個控制器UIViewController上去


我現在有一個UIControllerView 里面addView了一個UIView,我在點擊UIView的時候轉到另一個UIControllerView,按上面的導航條上面的返回按鈕返回第一個UIControllerView,在那個UIView里怎么用pushViewController

在UIView里發送消息

[[NSNotificationCenter defaultCenter] postNotificationName:@"push" object:nil];

 

在父類控制器接收消息並

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pushOne) name:@"push" object:nil];

-(void)pushOne

{

    YYCSettingController *setting=[[YYCSettingController alloc]init];

        [self.navigationController pushViewController:setting animated:YES];

}

 

發送消息
[[NSNotificationCenter defaultCenter]
     postNotificationName:@"chuandi" object:self]; 
接收消息 自己寫個action的動作
[[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(action)
                                                 name:@"chuandi" object:nil];
比如你在 一個子類里觸發一個事件后   把消息傳遞到父類   在父類里的action 指向 推向另一個子類  就可以把


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM