标签:
发送消息:
NSDictionary *dict=[[NSDictionary alloc]initWithObjectsAndKeys:@"num",[NSString stringWithFormat:@"%d",person.i_Msg], nil]; [[NSNotificationCenter defaultCenter] postNotificationName:@"hideTabBar" object:self userInfo:dict];
接收消息:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hideTabBar:) name:@"hideTabBar" object:nil];
-(void)hideTabBar:(id)sender
{
NSString *num=[[sender userInfo] objectForKey:@"num"];
_numOfmsg = _numOfmsg-[num intValue];
[self.tabBar showBadgeOnItemIndex:3 andNumber:_numOfmsg];
if (_numOfmsg==0) {
[self.tabBar hideBadgeOnItemIndex:3];
}
}
标签:
原文地址:http://www.cnblogs.com/SimonGao/p/4655120.html