iphoneSafeAreaInsets

Typefunction
DictionaryLCS
LibraryLiveCode Script
Syntax
iphoneSafeAreaInsets()
Summary

Returns the safe area insets of the device the app is running on.

Introduced9.6.6
OSios
Platformsmobile
Example
local tInsets
put iphoneSafeAreaInsets() into tInsets
if the top of field "Title" < item 2 of tInsets then
   set the top of field "Title" to item 2 of tInsets
end if

local tSafeAreaRect
put the screenRect into tSafeAreaRect
add item 1 of iphoneSafeAreaInsets() to item 1 of tSafeAreaRect
add item 2 of iphoneSafeAreaInsets() to item 2 of tSafeAreaRect
subtract item 3 of iphoneSafeAreaInsets() from item 3 of tSafeAreaRect
subtract item 4 of iphoneSafeAreaInsets() from item 4 of tSafeAreaRect
set the rect of field "FullSafeAreaField" to tSafeAreaRect
Values
NameTypeDescription
return

The iphoneSafeAreaInsets function returns a string consisting of the safe area insets separated by commas, in the order left, top, right, bottom.

Description

Use the iphoneSafeAreaInsets function to get the safe area insets of the device the app is running on. The safe area of a view reflects the area not covered by device furniture items, e.g. the notch, that obscure a view controller's view, and the insets denote the spacing between the device's screen's edges and where this safe area begins. These can be used to adjust your app's user interface elements to avoid areas that will not be fully visible.