本文介绍了iPhone-X-如何强制用户两次滑动主屏幕指示器以进入主屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用下面的代码在iPhone X上隐藏主页指示器,该指示器在模拟器中可以正常工作.

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.

那么,如何强制用户两次滑动主屏幕指示器以使用Objective-C进入iOS 11的主屏幕?

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.

推荐答案

遇到了同样的问题.

PrefersHomeIndicatorAutoHidden必须返回NO,但PreferredScreenEdgesDeferringSystemGestures也必须被覆盖并返回UIRectEdgeBottom.

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

override var prefersHomeIndicatorAutoHidden: Bool {
  return false
}

override var preferredScreenEdgesDeferringSystemGestures: UIRectEdge {
  return UIRectEdge.bottom
}

这篇关于iPhone-X-如何强制用户两次滑动主屏幕指示器以进入主屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-03 05:56