指定在此应用程序的 iOS 版本中是否应隐藏主页按钮。
在 iPhone X 上,主页按钮以系统手势(从屏幕底部向上滑动)实现。此虚拟按钮的位置由白条标示。如果启用此设置,只要用户数秒内未触碰屏幕,主页按钮就会从视图上隐藏。请注意,iOS 人机交互指南不建议为不包含被动观看体验(例如观看视频或幻灯片放映)的应用程序启用此行为。主页按钮可以通过更改 iOS.Device.hideHomeButton
属性在运行时隐藏。
using UnityEngine; using UnityEditor;
public class HideHomeButtonExample { // This example will create a Menu Item called "Hide Home Button" under "Examples" submenu which when pressed will print the current value of hideHomeButton to console and then change it to "true" [MenuItem("Examples/Hide Home Button")] public static void SimpleExample() { // This will print the value of "Hide Home Button" property for iOS (in "Project Settings/Player/Other Settings") to the console Debug.Log("Hide Home Button : " + PlayerSettings.iOS.hideHomeButton); // This will enable the "Hide Home Button" property for iOS (in "Project Settings/Player/Other Settings") PlayerSettings.iOS.hideHomeButton = true; } }