iOS Question Problem with Tapstrip on new iPhone 14 Pro and Pro Max

schimanski

Well-Known Member
Licensed User
Longtime User
On the new iPhone 14 Pro and Pro Max, there seems to be a problem with the view of tabstip. The top seems to be cut off:

IMG_4251.jpeg

or

IMG_4245.jpeg


As discussed here

https://www.b4x.com/android/forum/threads/white-bar-on-iphone-xs.107514/#post-672963

it seems not to be a problem with the iOs-Version but with the screen-resolution.

I changed Erel's code out of the link above. I don't know, if it is the correct way to get this problem under control, but it seems to work:

B4X:
Sub page_Resize (Width As Float, Height As Float)
 
    Dim DeviceName As String = Me.As(NativeObject).RunMethod("deviceName", Null).AsString

    If TabStrip1.IsInitialized And Main.App.OSVersion >= 11 Then
        Dim no As NativeObject = TabStrip1
        Dim window As NativeObject = Main.App
        window = window.GetField("keyWindow")
        Dim f() As Float = window.ArrayFromEdgeInsets(window.RunMethod("safeAreaInsets", Null))
        If f(1) > 0 Then
            Dim Container As View = no.GetField("containerView")
            Sleep(50)
            Dim PrevTop As Int = Container.Top
     
            If DeviceName="iPhone15,3" Or DeviceName="iPhone15,2" Then
                Container.Top = 49 - f(1)
            Else
                Container.Top = 44 - f(1)
            End If
            Container.Height = Container.Height + PrevTop - Container.top
        End If
    End If
End Sub

#If OBJC
#import <sys/utsname.h>
- (NSString*) deviceName
{
  struct utsname systemInfo;

  uname(&systemInfo);

  NSString* code = [NSString stringWithCString:systemInfo.machine
      encoding:NSUTF8StringEncoding];
  return code;
 }
 #end if

The iPhone 14 Plus is not affected.
Still interesting: It's only a problem under portrait, but not in landscape-mode.
 

Attachments

  • p1.png
    p1.png
    53.8 KB · Views: 130
Last edited:
Top