Iphone 从模式视图控制器返回-是否有检测方法?
不知是否有人能帮助我。我有一个设置,其中一个主菜单显示作为模态视图控制器的主游戏。此时,它也停止播放主菜单音乐 问题是,当游戏视图控制器自行关闭(例如,当用户退出游戏)并返回主菜单时,我无法让主菜单音乐重新开始播放 有什么方法可以让主菜单中的音乐重新开始播放吗?例如,当主游戏解散时调用的委托方法 谢谢Iphone 从模式视图控制器返回-是否有检测方法?,iphone,objective-c,uiviewcontroller,Iphone,Objective C,Uiviewcontroller,不知是否有人能帮助我。我有一个设置,其中一个主菜单显示作为模态视图控制器的主游戏。此时,它也停止播放主菜单音乐 问题是,当游戏视图控制器自行关闭(例如,当用户退出游戏)并返回主菜单时,我无法让主菜单音乐重新开始播放 有什么方法可以让主菜单中的音乐重新开始播放吗?例如,当主游戏解散时调用的委托方法 谢谢 马丁你可以通过NotificationManager来完成 // set up notification [[NSNotificationCenter defaultCenter] addObse
马丁你可以通过NotificationManager来完成
// set up notification
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playMusic:)
name:@"musicNotification"
object:nil];
// send notification
[[NSNotificationCenter defaultCenter] postNotificationName:@"musicNotification"
object:self];
// clean up notification
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
- (void) playMusic:(NSNotification *) notification
{
// play the music here
if ([[notification name] isEqualToString:@"musicNotification"])
NSLog (@"Received musicNotification!");
}