简体   繁体   中英

how can we run GUI code when app is firing applicationWillResignActive:

i want to execute some GUI code ,let suppose I want to make the LED on when app fires applicationWillResignActive: event , how can I do this ? Can I delay the firing of this event until code executes or there is any other method available for doing this?

No you cannot delay this event being fired

Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.

You can respond by putting your code in the application delegate method

- (void)applicationWillResignActive:(UIApplication *)application;

or by observing for the UIApplicationWillResignActiveNotification notification

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM