通知的用法

 loadAds  这个参数是随便传的。

在需要改变值的页面用下面一句。需要刷新的页面。。。

[[NSNotificationCenterdefaultCenter] addObserver:selfselector:@selector(loadAds) name:@"loadAds"object:nil];

 

在代理执行后值改变的页面。值改变了,但是不能给页面赋值。。。

[[NSNotificationCenter defaultCenter]postNotificationName:@"loadAds" object:nil];

 

有时候不用remove.。

 [[NSNotificationCenterdefaultCenter]removeObserver:selfname:@"screen_name"object:nil];

猜你喜欢

转载自zhangmingwei.iteye.com/blog/2034613
今日推荐