NSLog(@"这个值=%f",_slider.value);
self.textsize=_slider.value;
//广播
NSDictionary *dict=[NSDictionary dictionaryWithObjectsAndKeys:self,@"edit", nil];
NSNotificationCenter *nc=[NSNotificationCenter defaultCenter];
NSNotification *notify=[NSNotification notificationWithName:@"FontSettings" object:self userInfo:dict];
[nc postNotification:notify];
-(void)registerBcast
{
NSNotificationCenter *nc =[NSNotificationCenter defaultCenter];
[nc addObserver:self selector:@selector(recvBcast:) name:@"FontSettings" object:nil];
}
-(void)recvBcast:(NSNotification *)notify
{
NSDictionary *dict=[notify userInfo];
label.font=[UIFont systemFontOfSize:[[dict objectForKey:@"edit"] textsize]];
}
ios notify 用例
最新推荐文章于 2020-03-28 15:54:36 发布