码迷,mamicode.com
首页 > 移动开发 > 详细

IOS 消息

时间:2015-07-17 18:39:21      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:

发送消息:

 

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

 

IOS 消息

标签:

原文地址:http://www.cnblogs.com/SimonGao/p/4655120.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!