iOS关于通知传值Bool类型的注意点

比如:

    [[NSNotificationCenter defaultCenter] postNotificationName:@"Notification_Name" object:nil userInfo:@{@"paramName":@YES}];

  

再接收通知获取参数处理时:

-(void)Handle:(NSNotification *)notification{
    BOOL isFirst = notification.userInfo[@"isFirstLocation"];
    NSLog(@"isFirst:%d",isFirst);
    //这里不能直接写 if (isFirst),必须如下写法
    if (isFirst == 1) {
        //表示Yes
    }
}

  

if判断里,必须写 == 1/0,来判断yes/no

 

小细节,别忽略了哦

posted @ 2016-12-29 16:06  那一抹风情  阅读(2524)  评论(0编辑  收藏  举报