Is it possible to programmatically instantiate a custom view within another custom view? For instance, I have created a modal/dialog custom view that I would like to embed a CustomListView inside. The modal view is added via the designer, but the CustomListView ideally will be instantiated and managed by the modal. After initializing the CustomListView and attempting to attach it to a child view of my custom modal, I receive an unrecognized selector error.
Operation that causes error:
Error message:
If composition of custom views is possible, an example would be greatly appreciated. Thanks for reading!
Operation that causes error:
B4X:
UserListView.Initialize(ModalBackgroundPanel, "UserListView")
ModalForegroundPanel.AddView(UserListView, 0, 0, 100, 100)
Error message:
B4X:
Error occurred on line: 62 (UserPicker)
-[b4i_customlistview superview]: unrecognized selector sent to instance 0x1c00b3e60
Stack Trace: (
CoreFoundation <redacted> + 148
libobjc.A.dylib objc_exception_throw + 56
CoreFoundation <redacted> + 0
CoreFoundation <redacted> + 1380
CoreFoundation _CF_forwarding_prep_0 + 92
UIKit <redacted> + 148
BirdID iOS -[B4IPanelWrapper AddView:::::] + 132
CoreFoundation <redacted> + 144
CoreFoundation <redacted> + 292
BirdID iOS +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
BirdID iOS -[B4IShell runVoidMethod] + 232
BirdID iOS -[B4IShell raiseEventImpl:method:args::] + 1416
BirdID iOS -[B4IShellBI raiseEvent:event:params:] + 1408
BirdID iOS __24-[B4ITimer startTicking]_block_invoke + 332
libdispatch.dylib <redacted> + 16
libdispatch.dylib <redacted> + 428
libdispatch.dylib <redacted> + 1588
libdispatch.dylib <redacted> + 720
CoreFoundation <redacted> + 12
CoreFoundation <redacted> + 2012
CoreFoundation CFRunLoopRunSpecific + 436
GraphicsServices GSEventRunModal + 100
UIKit UIApplicationMain + 208
BirdID iOS main + 124
libdyld.dylib <redacted> + 4
)
If composition of custom views is possible, an example would be greatly appreciated. Thanks for reading!