iOS Question Different display in iPhone-6 + and iPhone-X

Filippo

Expert
Licensed User
Hi,
I have a different display between iPhone-6 + and iPhone-X, and I can't explain why.
The blue pointer is simply not displayed on the iPhone-X.
Maybe someone can tell me where my mistake is, I don't see it.
A test project is inserted.

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Public App As Application
    Public NavControl As NavigationController
    Private Page1 As Page
    Private pnlRoot As Panel
    
    'Variablen für der Zeiger
    Dim pnlCrono As Panel
    Dim imgSetupZeiger As ImageView
    Dim pnlZeiger As Panel
    Dim bmpNeedleBlue As Bitmap
    Dim csvSetupZeiger As Canvas
    Dim DRectCrono As Rect

    Dim intfixedNeedle As Int = 1
End Sub

Private Sub Application_Start (Nav As NavigationController)
    NavControl = Nav
    Page1.Initialize("Page1")
    Page1.RootPanel.LoadLayout("Main")

    pnlRoot.LoadLayout("Page1")
    NavControl.ShowPage(Page1)

    NavControl.NavigationBarVisible = False

End Sub

Private Sub Page1_Resize (Width As Float, Height As Float)
    'Log("Page1_Resize")
    Dim r As Rect = Page1.SafeAreaInsets
    pnlRoot.SetLayoutAnimated(0, 1, r.Left, r.Top, Width - r.Right - r.Left, Height - r.Bottom - r.Top)
End Sub

Private Sub pnlRoot_Resize (Width As Float, Height As Float)
    Log("pnlRoot_Resize")

    SetupAnalogCrono
    
End Sub

Private Sub Page1_Appear
    If intfixedNeedle <> 0 Then
        intfixedNeedle = 0
        InitCrono
    End If
End Sub

Sub SetupAnalogCrono
    If intfixedNeedle <> 0 Then
        intfixedNeedle = 0
        InitCrono
    End If
    
    ShowFixedNeedle
End Sub

Sub ShowFixedNeedle
    Dim cv As Canvas
    cv.Initialize(pnlCrono)

    'Uhr-Untergrundsfläche färben
    cv.DrawCircle(pnlCrono.Width / 2, pnlCrono.Width / 2, pnlCrono.Width / 2 - 4dip, Colors.White, True, 8dip)
    'Aussenring zeichnen
    cv.DrawCircle(pnlCrono.Width / 2, pnlCrono.Width / 2, pnlCrono.Width / 2 - 4dip, Colors.DarkGray, False, 8dip)
    cv.Refresh
End Sub

Sub InitCrono
    Dim NeedleWidth As Int
    NeedleWidth = pnlCrono.Width / 12.23

    bmpNeedleBlue.Initialize(File.DirAssets, "zeiger-blau_856x70.png")

    DRectCrono.Initialize((pnlCrono.Width - NeedleWidth) / 2, 0, (pnlCrono.Width + NeedleWidth) / 2, pnlCrono.Height)

    csvSetupZeiger.Initialize(imgSetupZeiger)
    csvSetupZeiger.DrawColor(Colors.Transparent)

    csvSetupZeiger.DrawBitmapRotated(bmpNeedleBlue, DRectCrono, 0)
    csvSetupZeiger.Refresh

End Sub

IPhone-6+:
1599392936867.png


iPhone-X:
1599392966853.png
 

Attachments

  • Test-Canvas.zip
    12 KB · Views: 53

Andrew (Digitwell)

Well-Known Member
Licensed User
@Filippo can you confirm the iOS version on each phone. I had a problem where my images disappeared when moving to iOS 12.

The problem seemed to be that for some strange reason drawing on imageviews doesn't work anymore.

If you change the imageview imgSetupZeiger to a panel, as you do for the circle, pnlCrono then it should work.

I don't have a charged iPhone at the moment. But will try tomorrow.
 
Upvote 0

Filippo

Expert
Licensed User
@Filippo can you confirm the iOS version on each phone. I had a problem where my images disappeared when moving to iOS 12.
iPhone-6+ = iOS 12.4.8
iPhone-X = iOS 13.6.1

If you change the imageview imgSetupZeiger to a panel, as you do for the circle, pnlCrono then it should work.
I try it now.
 
Upvote 0

Filippo

Expert
Licensed User
Ok, now I have replaced the imageview with a panel and it works, thanks! :)
 
Upvote 0

Semen Matusovskiy

Well-Known Member
Licensed User
B4X:
Maybe someone can tell me where my mistake is, I don't see it.

IMO, logic of redrawing should be following. At first, do all actions, after which IOS redraws views (for example, resize). Then you can use Canvas and to draw everything.
Relative to your code. In InitCrono (which you call once) load bitmap only. Execute ...DrawBitmapRotated in ShowFixedNeedle. This will work in any IOS.
 
Upvote 0
Top