iOS Question [B4X] Iterate return error with custom font


Active Member
Licensed User
Hi All,

I am having a problem that I might be doing something wrong but can not spot that!

If I use the code below to set custom font to single BRB4XFloatTextField it is working fine:

private ACT as BRB4XFloatTextField
ACT.TextField.font  = Font.CreateNew2("neosansarabic", 14)

However if I do this it fails:

For Each v As BRB4XFloatTextField In Root.GetAllViewsRecursive
    v.TextField.font  = Font.CreateNew2("neosansarabic", 14)

And I receive this error stack:

Error occurred on line: 952 (B4XMainPage)
[<UIScrollView 0x7faa82868400> valueForUndefinedKey:]: this class is not key value coding-compliant for the key bi.
Stack Trace: (
  CoreFoundation       __exceptionPreprocess + 242
  libobjc.A.dylib      objc_exception_throw + 48
  CoreFoundation       -[NSException init] + 0
  Foundation           -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 225
  Foundation           -[NSObject(NSKeyValueCoding) valueForKey:] + 317
  B4i Example          -[B4IShell getField] + 169
  B4i Example          -[B4IShell raiseEventImpl:method:args::] + 2285
  B4i Example          -[B4IShellBI raiseEvent:event:params:] + 1357
  B4i Example          __33-[B4I raiseUIEvent:event:params:]_block_invoke + 51
  libdispatch.dylib    _dispatch_call_block_and_release + 12
 libdispatch.dylib    _dispatch_client_callout + 8
 libdispatch.dylib    _dispatch_main_queue_callback_4CF + 1045
 CoreFoundation       __CFRunLoopRun + 2685
 CoreFoundation       CFRunLoopRunSpecific + 567
 GraphicsServices     GSEventRunModal + 139
 UIKitCore            -[UIApplication _run] + 912
 UIKitCore            UIApplicationMain + 101
 B4i Example          main + 112
 libdyld.dylib        start + 1

I tried clean project but nothing changed, I am receiving the same error.


Active Member
Licensed User
Longtime User
are there only BRB4XFloatTextField in your layout? Otherwise Root.GetAllViewsRecursive might get some view that can not be casted to a BRB4XFloatTextField.
Upvote 0


Active Member
Licensed User
Thank you both so much for your reply! This makes sense, so will try to implement this and post here, thanks a lot for ur help! Appreciate it!
Upvote 0