Stops updating OpenGL view in iOS while app is inactive.

This commit monitors the application state to register or unregister the display link in iOS. Without doing this, the app may crash while the state transitioned from active to inactive state. As a result, the OpenGL view does not update anymore while the app is inactive, which also means the view is not visible on the screen, and this is good for saving battery life as well.