zoukankan      html  css  js  c++  java
  • 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 指向 推向另一个子类  就可以把

  • 相关阅读:
    vue , debounce 使用
    git 合并代码
    vue-snippet-模板
    旋转字符串
    给一个整数数组,找到两个数使得他们的和等于一个给定的数 target。
    水仙花数[js]
    一道笔试题(vue,react)
    OC中一些基本概念
    如何添加渐变?
    UIBarButtonItem关于全局修改,局部修改
  • 原文地址:https://www.cnblogs.com/ithongjie/p/5172786.html
Copyright © 2011-2022 走看看