`
wonderzl
  • 浏览: 78896 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

NSNotificationCenter随笔

阅读更多
    可在AppDelegate.h中定义,之后可全局使用。

NSNotificationCenter *notificationCenter;

在.m文件中:
- (void)applicationDidFinishLaunching:(UIApplication *)application
{    
	self.notificationCenter = [NSNotificationCenter defaultCenter];
	[notificationCenter addObserver:self selector:@selector(trackNotifications:) name:nil object:nil];

}

- (void) trackNotifications: (NSNotification *) notification
{
	id nname = [notification name];
	
	if([nname isEqual:@"***"])
	{
		......
	}else if([nname isEqual:@"***"])
	{
		......
	}else if([nname isEqual:@"***"])
	{
		......
	}else if([nname isEqual:@"***"])
	{
		......
	}else if([nname isEqual:@"***"])
	{
		......
	}
}



      在别的地方使用的时候,只需要调用[[NSNotificationCenter defaultCenter] postNotificationName:@"about" object:@""];

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics