IOS两个类之间的传递方法:
1、使用广播通知类。
在类A的viewDidLoad方法中注册一个通知:
<span style="font-family:Times New Roman;">[[NSNotification defaultCenter] addObserver:self selector:@selector(changeBackgrundColor:) name:@"</span><span style="font-family: 'Times New Roman';">backgroundColor</span><span style="font-family: 'Times New Roman';">" object:nil];</span>
接受通知后要处理的方法。<span style="font-family:Times New Roman;">-(void) </span><span style="font-family: 'Times New Roman';">changeBackgrundColor</span><span style="font-family: 'Times New Roman';">:(NSNotification*) notification</span><span style="font-family:Times New Roman;">
</span><span style="font-family:Times New Roman;">{
[self.detailDescriptionLabel setBackGrooundColor:[UIColor blueColor]];
}</span>
<span style="font-family:Times New Roman;">NSString *color = @"blue";
[[NSNotificationCenter defaultCenter] postNotificationName:@"backgroundColor" object:color userInfo:nil];</span>