Search code examples
objective-cios9

viewWillTransitionToSize called even if i press power button


While my app is running and i press power button (To lock the device) this function is calling.

- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator

And returning current state UIApplicationStateActive using

[UIApplication sharedApplication].applicationState

How to prevent calling this function ? or how to ignore if power button is press? because i don't want to perform any action on powerButton press.

Precondition : Launch Screen should be present.


Solution

  • This function calling on app minimise and power button press due to new feature of multitasking.
    You can make your application full screen to solve this problem.

    Check on ✓ Requires full screen

    enter image description here

    But this is not the proper solution because you have to adopt multitasking in some case.