Bir uygulamanın "arka plan modu" ndan yeni döndüğünü nasıl anlayabilirim? Yani, kullanıcı "ana düğme" düğmesine bastığında uygulamamın verileri (60 saniyede bir) almasını istemiyorum. Ancak, uygulamanın ön plan modunda olduğu ilk seferde bazı "özel" güncellemeyi yapmak istiyorum.iphone 4 sdk: arka plan modundan dönüş algılandı
nasıl bu iki etkinliği tespit edebilir:
- uygulama önceden ön plan moduna
Teşekkür gidiş
// Register for notification when the app shuts down
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myFunc) name:UIApplicationWillTerminateNotification object:nil];
// On iOS 4.0+ only, listen for background notification
if(&UIApplicationDidEnterBackgroundNotification != nil)
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myFunc) name:UIApplicationDidEnterBackgroundNotification object:nil];
}
// On iOS 4.0+ only, listen for foreground notification
if(&UIApplicationWillEnterForegroundNotification != nil)
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(myFunc) name:UIApplicationWillEnterForegroundNotification object:nil];
}
Not:
François
teşekkür bakın! –