iOS Question What is wrong with the B4i code of this class

Discussion in 'iOS Questions' started by hatzisn, Aug 14, 2019.

  1. hatzisn

    hatzisn Active Member Licensed User

    Hi everybody,

    I have posted this post in the forum but I suppose I have posted in the wrong forum since I also want some help.
    https://www.b4x.com/android/forum/t...for-b4i-code-is-ready-but-not-working.108599/

    What is wrong with the code in CreateStep sub and the same code works for Android but not for iOS (it doesn't draw the picture you see in the previous link but no errors exist in the IDE).

    Thanks in advance
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    It is a mistake to post a non-working library.

    Create a small project that demonstrates the issue and upload it.
     
  3. hatzisn

    hatzisn Active Member Licensed User

    You are right. My mistake... Please delete the post in b4i libraries forum as I cannot.
    Here is a project demonstrating the non-working class in b4i. If you migrate the project to B4A the same code works perfectly (as seen in the other - to be deleted - post).
     

    Attached Files:

    • wn.zip
      File size:
      64.4 KB
      Views:
      11
  4. Erel

    Erel Administrator Staff Member Licensed User

    1. You should never use percentage units outside of the resize event:
    Code:
    p.Height = 100%y
       p.Width = 
    100%x
    Worth watching this video tutorial: https://www.b4x.com/etp.html?vimeography_gallery=1&vimeography_video=255731307

    2. This is not needed:
    Code:
    #if b4a
           lNext.TextSize = iNavFontSize
           lBack.TextSize = iNavFontSize
           lExplain.TextSize = ExplanationFontSize
           lNext.Typeface = 
    Typeface.DEFAULT_BOLD
           lBack.Typeface = 
    Typeface.DEFAULT_BOLD
           lExplain.Typeface = 
    Typeface.DEFAULT
           lExplain.SingleLine = 
    False
       
    #else if b4i
       lNext.Font = lNext.Font.CreateNewBold(iNavFontSize)
       lBack.Font = lBack.Font.CreateNewBold(iNavFontSize)
       lExplain.Font = lBack.Font.CreateNew(ExplanationFontSize)
    All Labels should be converted to B4XView and you should use XUI.CreateFont.

    3. You should use B4XCanvas instead of Canvas.
    4. Make sure to call B4XCanvas.Invalidate when done drawing.
    5. Make sure to call B4XCanvas.Release when done with the canvas.
    6. It is better to reuse the canvases instead of creating new ones each time.
     
    anOparator likes this.
  5. hatzisn

    hatzisn Active Member Licensed User

    Erel 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