visionOS: always use touchscreen

This commit is contained in:
Jesús A. Álvarez 2024-02-10 12:19:20 +01:00
parent 7c1f280374
commit 33e01e0847
1 changed files with 4 additions and 0 deletions

View File

@ -166,8 +166,12 @@ API_AVAILABLE(ios(13.4))
}
#endif
#if defined(TARGET_OS_VISION) && TARGET_OS_VISION == 1
Class pointingDeviceClass = [TouchScreen class];
#else
BOOL useTrackPad = [[NSUserDefaults standardUserDefaults] boolForKey:@"trackpad"];
Class pointingDeviceClass = useTrackPad ? [TrackPad class] : [TouchScreen class];
#endif
pointingDeviceView = [[pointingDeviceClass alloc] initWithFrame:self.view.bounds];
pointingDeviceView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view insertSubview:pointingDeviceView aboveSubview:self.screenView];