1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

iOS Question how to convert object to imageview

Discussion in 'iOS Questions' started by bagazhou, Jul 5, 2019.

  1. bagazhou

    bagazhou Member Licensed User

    HI

    this code in b4i , how to can i convert object to imageview ?


    Code:
    Sub SetBackgroundImage(b As Object, bmp As Bitmap, state As Int)

       
    If b Is Button Then
           
    Dim no As NativeObject = b
           no.RunMethod(
    "setBackgroundImage:forState:"Array(bmp, state))
       
    End If
       
       
    If b Is ImageView Then
           b.Bitmap = 
    LoadBitmap(File.DirAssets, "test.png")  //this line is error
           
       
    End If
       
       

    End Sub
     
  2. bagazhou

    bagazhou Member Licensed User

    I solved the problem

    Code:
    Sub SetBackgroundImage(b As Object, bmp As Bitmap, state As Int)

       
    If b Is Button Then
           
    Dim no As NativeObject = b
           no.RunMethod(
    "setBackgroundImage:forState:"Array(bmp, state))
       
    End If
       
       
    If b Is ImageView Then
           
    Dim img As ImageView
           img = b
           img.Bitmap = bmp
       
    End If
       
    End Sub
     
    XbNnX_507 likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice