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

hatzisn

Well-Known Member
Licensed User
Longtime 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
 

hatzisn

Well-Known Member
Licensed User
Longtime 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).
 

Attachments

  • wn.zip
    64.4 KB · Views: 133
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. You should never use percentage units outside of the resize event:
B4X:
    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:
B4X:
   #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.
 
Upvote 0

hatzisn

Well-Known Member
Licensed User
Longtime User
Upvote 0
Top