IOS通知的注册和调用

注册通知

[[NSNotificationCenterdefaultCenter] addObserver:selfselector:@selector(changeLabelText:)name:@”ChangeLabelTextNotification”object:nil];

通知方法:

-(void)changeLabelText:(NSNotification *)notification{

id text = notification.object;

UILabel *label = (UILabel*)[self.viewviewWithTag:102];

label.text = text;

}

通知的调用:

[[NSNotificationCenterdefaultCenter]postNotificationName:@”ChangeLabelTextNotification”object:self._textField.text];

原文链接:http://blog.csdn.net/g2321514568/article/details/26847021

你可能感兴趣的:(iOS开发_开发模式,iOS_UI)