2011-09-22 95 views

回答

1

所有你需要做的是一个参考的viewController在另外一个,这样你可以调用它的方法。或者你可以简单地创建一个委托。

1

一个可能的解决方案是使用notifications

在播放声音的操作中,向默认通知中心发送通知,指示声音已播放。

[[NSNotificationCenter defaultCenter] postNotificationName:"playSoundNotification" 
                object:self 
                userInfo:nil]; 

当创建OneViewController时,让它注册通知。

[[NSNotificationCenter defaultCenter] addObserver:self 
             selector:@selector(showPlayedLabel:)             
              name:"playSoundNotification" 
              object:nil]; 

当它收到通知时 - 在showPlayedLabel中: - 显示UILabel。请注意,showPlayedLabel必须遵循适当的签名格式。

- (void) showPlayedLabel:(NSNotification*) aNotification; 
相关问题