API我们知道了,可是加到哪里?然后通过分析Unity打包后的Xcode工程,在工程目录
Classes->UI->UnityViewControllerBaseiOS.mm
的脚本中,发现被重写的方法,如下:
// 延迟系统手势
- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures
{
UIRectEdge res = UIRectEdgeNone;
if(UnityGetDeferSystemGesturesTopEdge())
res |= UIRectEdgeTop;
if(UnityGetDeferSystemGesturesBottomEdge())
res |= UIRectEdgeBottom;
if(UnityGetDeferSystemGesturesLeftEdge())
res |= UIRectEdgeLeft;
if(UnityGetDeferSystemGesturesRightEdge())
res |= UIRectEdgeRight;
return res;
}
// 是否自动隐藏home条
-(BOOL)prefersHomeIndicatorAutoHidden{
return UnityGetHideHomeButton();
}
我们只需要改成如下即可:
参考文章:https://blog.csdn.net/qqo_aa/article/details/78751594
- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures
{
return UIRectEdgeAll;
}
- (BOOL)prefersHomeIndicatorAutoHidden
{
return false;
}