From 0df5135f0bc0190a610c207021c253aefb80f28a Mon Sep 17 00:00:00 2001 From: TrueZhuanjia Date: Fri, 25 Jul 2025 20:18:43 +0800 Subject: [PATCH] fix: widgets disappears after display orientation change & saving profile in osw tool --- .../LayoutOnScreenControlsViewController.m | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/VoidLink/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m b/VoidLink/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m index 2879fa9e..db269384 100644 --- a/VoidLink/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m +++ b/VoidLink/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m @@ -243,7 +243,10 @@ selector: @selector(handleReturnToForeground) name: UIApplicationDidBecomeActiveNotification object: nil]; - + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(deviceOrientationDidChange) // handle orientation change since i made portrait mode available + name:UIDeviceOrientationDidChangeNotification + object:nil]; OnScreenWidgetView.editMode = true; [self handleMissingToolBarIcon:toolbarRootView]; @@ -256,6 +259,13 @@ [OSCProfilesManager setOnScreenWidgetViewsSet:self.onScreenWidgetViews]; // pass the keyboard button dict to profiles manager } +- (void)deviceOrientationDidChange{ + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + sleep(1); + [OSCProfilesManager setOnScreenWidgetViewsSet:self.onScreenWidgetViews]; // pass the keyboard button dict to profiles manager + }); +} + /* fades the 'Undo Button' in or out depending on whether the user has any OSC layout changes to undo */ - (void) OSCLayoutChanged { if ([self.layoutOSC.layoutChanges count] > 0) {