zoukankan      html  css  js  c++  java
  • IOS的通知

    通知的用法传值。

      //参数一:监听者

        //参数二:收到监听后的回调

        //参数三:通知的名字(区分是哪一个通知)

        //参数四:是发送通知时的obejct

      [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(no:) name:@"我" object:nil];//获取通知中心的单例,在接受参数,调用方法

    //这个方法是通知调用的方法

    -(void)no:(NSNotification *)no{

        NSLog(@"name %@",no.name);

        NSLog(@"userInfo %@",no.userInfo);

        [self showMaskView]   

    }

    //以上为通知的观察者,观察者通过观察name来确定是哪个通知,并且name的值是唯一的。

    //下面是发送通知的POST   首先获取通知中心的单例,在Post通知 的名字,object 和发送的内容

        [[NSNotificationCenter defaultCenter]postNotificationName:@"我" object:nil userInfo:@{@"text":@"wang",@"wangcai":@"YES"}];

     

  • 相关阅读:
    反向迭代
    c++知识点
    LeetCode-Count Bits
    LeetCode-Perfect Rectangle
    LeetCode-Perfect Squares
    LeetCode-Lexicographical Numbers
    LeetCode-Find Median from Data Stream
    LeetCode-Maximal Square
    LeetCode-Number of Digit One
    LeetCode-Combination Sum IV
  • 原文地址:https://www.cnblogs.com/fengwuqingyang/p/4961423.html
Copyright © 2011-2022 走看看