Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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;
}

But even though it's hidden, I am still able to swipe up from the bottom and my game goes to the home screen.

I have seen a few games where the user has to swipe up once to bring up the home indicator and swipe up again to go to the home screen.

So, how can I force the user to swipe the home indicator twice to go to the home screen in iOS 11 with Objective-C?

This behavior is required for full-screen games.

like image 753
smit patel Avatar asked Nov 17 '17 09:11

smit patel


People also ask

How do I change swipe gestures on iPhone?

Changing your swipe actionsTap the settings icon. Tap General. Scroll down to Swipe actions at the bottom of the screen. Choose whether you want to Select, Complete, Schedule, or Delete a task when swiping left or right.

How do you get gestures on iPhone?

Swipe down from the top-right corner to open Control Center; touch and hold a control to reveal more options. To add or remove controls, go to Settings > Control Center. See Use and customize Control Center on iPhone.


1 Answers

I had the same problem.

PrefersHomeIndicatorAutoHidden must return NO but also PreferredScreenEdgesDeferringSystemGestures must be overridden and return UIRectEdgeBottom.

Swift 4.2

override var prefersHomeIndicatorAutoHidden: Bool {
  return false
}

override var preferredScreenEdgesDeferringSystemGestures: UIRectEdge {
  return UIRectEdge.bottom
}
like image 118
filo Avatar answered Oct 07 '22 01:10

filo