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


Well-Known 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.

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


Well-Known 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).



Staff member
Licensed User
1. You should never use percentage units outside of the resize event:
    p.Height = 100%y
   p.Width = 100%x
Worth watching this video tutorial:

2. This is not needed:
   #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.