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

View File

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