From b30ce069922b57656f58c531a5bec614f00a7fda Mon Sep 17 00:00:00 2001 From: Filipe Azevedo Date: Mon, 15 May 2017 22:13:25 +0200 Subject: iOS: Fix the shortcuts bar not correctly hidden MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To avoid a compiler warning due to a wrong Apple api, a wrong workaround was introduced. This caused the hide of the shortcuts as expects but the visual space reserved for shortcuts was still visible as at top with a height of ~55pixels. While this is not important because the default virtual keyboard is always shown, it become a problem when one want to introduce his own virtual keyboard (UIResponder.inputView) with no shortcuts bar. This fix really hide the shortcuts bar. Task-number: QTBUG-60812 Change-Id: I0da44dfc3fda15af3351543c0a05aac973b899b9 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiostextresponder.mm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index eab6792266..001985a128 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -242,11 +242,12 @@ if (platformData.value(kImePlatformDataHideShortcutsBar).toBool()) { // According to the docs, leadingBarButtonGroups/trailingBarButtonGroups should be set to nil to hide the shortcuts bar. // However, starting with iOS 10, the API has been surrounded with NS_ASSUME_NONNULL, which contradicts this and causes - // compiler warnings. And assigning just an empty array causes layout asserts. Hence, we assign empty button groups instead. - UIBarButtonItemGroup *leading = [[[UIBarButtonItemGroup alloc] initWithBarButtonItems:@[] representativeItem:nil] autorelease]; - UIBarButtonItemGroup *trailing = [[[UIBarButtonItemGroup alloc] initWithBarButtonItems:@[] representativeItem:nil] autorelease]; - self.inputAssistantItem.leadingBarButtonGroups = @[leading]; - self.inputAssistantItem.trailingBarButtonGroups = @[trailing]; + // compiler warnings. Still it is the way to go to really hide the space reserved for that. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnonnull" + self.inputAssistantItem.leadingBarButtonGroups = nil; + self.inputAssistantItem.trailingBarButtonGroups = nil; +#pragma clang diagnostic pop } } #endif -- cgit v1.2.3