iOS Question [Solved] Type does not match (B4IPanelView)

angel_

Well-Known Member
Licensed User
Longtime User
I have this error Type does not match (B4IPanelView), I use this:


This is my code:
B4X:
Wait For (ImageLoader.LoadFromFile(Directorio, FileName, DimensionMax, DimensionMax)) Complete (bmp As B4XBitmap)
If bmp.IsInitialized And img.Parent.IsInitialized Then
    ResizeImageViewBasedOnBitmapRatio(img, bmp)
End If

B4X:
Private Sub ResizeImageViewBasedOnBitmapRatio(iv As B4XView, bmp As B4XBitmap)
    Dim bmpRatio As Float = bmp.Width / bmp.Height
    Dim viewRatio As Float = iv.Parent.Width / iv.Parent.Height
    Dim Height, Width As Int
    If viewRatio > bmpRatio Then
        Height = iv.Parent.Height
        Width = iv.Parent.Height * bmpRatio
    Else
        Width = iv.Parent.Width
        Height = iv.Parent.Width / bmpRatio
    End If
    iv.SetLayoutAnimated(0, iv.Parent.Width / 2 - Width / 2, iv.Parent.Height / 2 - Height / 2, Width, Height)
    iv.SetBitmap(bmp)   ' <<ERROR in this line, Type does not match (B4IPanelView)

    #if B4A
    Dim iiv As ImageView = iv
    iiv.Gravity = Gravity.FILL
    #End If
End Sub

Logs error
B4X:
Error occurred on line: 402 (a02)
Type does not match (B4IPanelView)
Stack Trace: (
  CoreFoundation       <redacted> + 252
  libobjc.A.dylib      objc_exception_throw + 56
  CoreFoundation       <redacted> + 0
  NameApp             -[B4XViewWrapper throwTypeDoesNotMatch] + 96
  NameApp             -[B4XViewWrapper SetBitmap:] + 212
  NameApp             -[b4i_a02_simbolos _resizeimageviewbasedonbitmapratio:::] + 1960
  CoreFoundation       <redacted> + 144
  CoreFoundation       <redacted> + 292
  NameApp             +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1608
  NameApp             -[B4IShell runMethod:] + 448
 NameApp             -[B4IShell raiseEventImpl:method:args::] + 1648
 NameApp             -[B4IShellBI raiseEvent:event:params:] + 1580
 NameApp             -[B4IDebugResumableSub resume::] + 356
 NameApp             -[B4I checkAndRunWaitForEvent:event:params:] + 516
 NameApp             -[B4IShellBI raiseEvent:event:params:] + 1436
 NameApp             __37-[B4ICommon ReturnFromResumableSub::]_block_invoke + 368
 libdispatch.dylib    <redacted> + 24
 libdispatch.dylib    <redacted> + 16
 libdispatch.dylib    <redacted> + 1068
 CoreFoundation       <redacted> + 12
 CoreFoundation       <redacted> + 1924
 CoreFoundation       CFRunLoopRunSpecific + 436
 GraphicsServices     GSEventRunModal + 104
 UIKitCore            UIApplicationMain + 212
 NameApp             main + 124
 libdyld.dylib        <redacted> + 4
)
 

Semen Matusovskiy

Well-Known Member
Licensed User
B4X:
iv.SetBitmap(bmp)   ' <<ERROR in this line, Type does not match (B4IPanelView)

Guess, iv was declared as Panel. Meanwhile B4i, unlike B4A, supports B4XView.SetBitmap method for ImageView only.
 
Upvote 0

angel_

Well-Known Member
Licensed User
Longtime User
B4X:
iv.SetBitmap(bmp)   ' <<ERROR in this line, Type does not match (B4IPanelView)

Guess, iv was declared as Panel. Meanwhile B4i, unlike B4A, supports B4XView.SetBitmap method for ImageView only.
In this case, I had the views in B4i in the designer as B4XImageView while B4A had as ImageView, I changed in the B4XImageView designer to ImageView in B4i, and it works, thank you.
 
Upvote 0
Top