We can register the events notifications via NSNotificationCenter, when the event trigger then notification center will send the notification for corresponding events.
Register using the following lines of code:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(customFunction) name:UIApplicationDidEnterBackgroundNotification object:nil];
//name is a NSString you can give available events in xcode
Then when the app did entered background it will call the below customFunction funtion
-(void) customFunction
{
// custom code
NSLog(@"Application enter into background");
}
No comments:
Post a Comment