您的位置:首页 > 移动开发 > IOS开发

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

2016-12-29 16:06 288 查看
比如:

[[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

小细节,别忽略了哦
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: