IPhone X操作条问题,希望大家有用

在ViewController代码中

如果使用自动隐藏HomeIndicator功能
// Controls the application’s preferred home indicator auto-hiding when this view controller is shown.

  • (BOOL)prefersHomeIndicatorAutoHidden {
    return YES;
    }
    会造成上划一次home操作条就会进入后台
    删掉上面这个接口改成添加
  • (UIRectEdge)preferredScreenEdgesDeferringSystemGestures
    {
    return UIRectEdgeAll;
    }

这样就会像王者荣耀一样,划第一次先是唤醒HomeIndicator,划第二次才会进入后台

坑:
1.prefersHomeIndicatorAutoHidden和preferredScreenEdgesDeferringSystemGestures不可一起使用,如果一起使用的话后者是不生效的。
2.iPhone X适配必须使用XCode9, 我用XCode8弄了半天都没效果 升级XCode9没改任何东西就可以了

希望给iphonex适配的带来一些帮助

9赞

非常有用.但是你的适配问题,刘海问题,是怎么解决的啊?

有用 谢谢大佬