How to stop/handle UI Operations in iOS when app moves to background state?

北城以北 提交于 2019-11-30 09:44:25

问题


My app can be launched via UIApplicationLaunchOptionsLocalNotificationKey in the background. In that case the usual flow to setup initail view controller and some animations on the app's landing-page/first-page of the app take place.

My question is, Is this a good practice, If I leave these animations like this even when my app is launched via OS in background? Three things I am concerned about:

  1. Some animations are continuous, like a circular-dot(UIImage) expanding and shrinking, using CAAnimation.

  2. Some views are added and removed as subviews to the keyWindow, based on user location.

  3. When user taps the home button, do I need to stop the animations and subview additions then also?

Making the animation stop and resume via applicationDidEnterBackground and applicationWillEnterForeground seems tedious.

来源:https://stackoverflow.com/questions/46584566/how-to-stop-handle-ui-operations-in-ios-when-app-moves-to-background-state

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!