Hi,
The following code is used in an app to retrieve the safe area on iOS:
function GetSafeAreaLayout: TRectF;
var
App: UIApplication;
Win: UIWindow;
Guide: UILayoutGuide;
begin
App := TUIApplication.Wrap (TUIApplication.OCClass.sharedApplication);
Win := TUIWindow.Wrap (App.windows.objectAtIndex (0));
Guide := Win.safeAreaLayoutGuide;
Result := Guide.layoutFrame.ToRectF;
end;
It is triggered in Resize, and worked for all iPhones when compiled under RAD 11.1. However, compiling under 11.2 and 11.3 patch 1, while the above function completes successfully on iPhone SE, 7 & 8, Result.Top returns as 0 when the app first starts (i.e. causes app to overlay system menu at top of phone). Either calling the function again after app start, or re-orientating the phone fixes the issue. This start-up problem does not happen on the iPhoneX.
Has anyone else encountered this issue and know of a fix, or is there a better, more reliable way to access the safe area?
Please accept my thanks in advance.