chuck3e Active Member Licensed User Longtime User Mar 19, 2021 #1 I can get the font scale used in an Android phone in B4a but the code doesn't work in B4i. Is there a way to get it from an iPhone in B4i?
I can get the font scale used in an Android phone in B4a but the code doesn't work in B4i. Is there a way to get it from an iPhone in B4i?
Semen Matusovskiy Well-Known Member Licensed User Mar 20, 2021 #2 Labels and some other views have an AdjustFontSizeToFit property. Upvote 0
chuck3e Active Member Licensed User Longtime User Mar 20, 2021 #3 Thank you, Semen Matusovskiy. I did find that option for my labels but I need some way to resize text in buttons which don't have that option. One text size doesn't want work in all phones. For instance, I design on my iPhone 6, but installing on an iPhone 8 the text doesn't fit. Upvote 0
Thank you, Semen Matusovskiy. I did find that option for my labels but I need some way to resize text in buttons which don't have that option. One text size doesn't want work in all phones. For instance, I design on my iPhone 6, but installing on an iPhone 8 the text doesn't fit.
Semen Matusovskiy Well-Known Member Licensed User Mar 20, 2021 #4 You can scale a font in buttons also (using IOS documentation) For example, after LoadLayout add following Code: Copy Dim no As NativeObject = Button1 Dim titleLabel As NativeObject = no.GetField ("titleLabel") titleLabel.RunMethod ("setAdjustsFontSizeToFitWidth:", Array (True)) titleLabel.RunMethod ("setLineBreakMode:", Array (4)) ' NSLineBreakByTruncatingTail; Tested in IOS 14.4 simulator only. Probably for early releases it's neccessary to set some additional fields. A sample ... Button1 has a font size = 100 (very large). Attachments Project.zip Project.zip 8.4 KB · Views: 317 Last edited: Mar 21, 2021 Upvote 0
You can scale a font in buttons also (using IOS documentation) For example, after LoadLayout add following Code: Copy Dim no As NativeObject = Button1 Dim titleLabel As NativeObject = no.GetField ("titleLabel") titleLabel.RunMethod ("setAdjustsFontSizeToFitWidth:", Array (True)) titleLabel.RunMethod ("setLineBreakMode:", Array (4)) ' NSLineBreakByTruncatingTail; Tested in IOS 14.4 simulator only. Probably for early releases it's neccessary to set some additional fields. A sample ... Button1 has a font size = 100 (very large).
chuck3e Active Member Licensed User Longtime User Mar 23, 2021 #5 Semen Matusovskiy, thank you so much!!!! That works on my IPhone 6! I'll try it on an iPhone 8 soon. I hope it also works on Labels and TextViews. I'll test that. Upvote 0
Semen Matusovskiy, thank you so much!!!! That works on my IPhone 6! I'll try it on an iPhone 8 soon. I hope it also works on Labels and TextViews. I'll test that.
chuck3e Active Member Licensed User Longtime User Mar 23, 2021 #6 Wishful thinking. Does not work on Labels or TextViews, but works great on Buttons. Thanks again. Upvote 0
Semen Matusovskiy Well-Known Member Licensed User Mar 23, 2021 #7 Different views have different properties/methods. The sample was for Buttons only. I added Label and TextField. IMO, to use SizeToFit and to decrease font size in cycle is better. Last edited: Mar 24, 2021 Upvote 0
Different views have different properties/methods. The sample was for Buttons only. I added Label and TextField. IMO, to use SizeToFit and to decrease font size in cycle is better.