iPhone-X - How to force user to swipe twice home indicator to go home-screen

前端 未结 4 1563
醉话见心
醉话见心 2021-02-05 17:55

I\'m using the code below to hide the home indicator on iPhone X, which is working fine in the emulator.

-(BOOL)prefersHomeIndicatorAutoHidden
{
    return YES;
         


        
4条回答
  •  野性不改
    2021-02-05 18:29

    Adding the following to the ViewController did the trick for me:

    - (UIRectEdge)preferredScreenEdgesDeferringSystemGestures
    {
        return UIRectEdgeBottom;
    }
    

    This made the Home Indicator more transparent and inactivated so that it requires an extra swipe in order to leave the game.

    You can also use UIRectEdgeAll instead of UIRectEdgeBottom to defer the system gestures on all edges of the screen.

提交回复
热议问题