IOS 消息

发送消息:

 

 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];
    }
  
    
    
}

 

posted on 2015-07-17 17:04  大木哥  阅读(237)  评论(0编辑  收藏  举报

导航