iOS Question B4XSwitch - how to set value

cwt

Active Member
Licensed User
Longtime User
I need to preset the value of a B4XSwitch in B4i - I can get the value after it has been changed but cannot find anywhere on how to preset the value when the page displays - using B4XPages.
 

cwt

Active Member
Licensed User
Longtime User
I get a runtime error - it appears I am not initializing the B4XSwith view properly. Below is the runtime error:

Unexpected event (missing RaisesSynchronousEvents): tabstrip1_pageselected:
Error occurred on line: 134 (B4XSwitch)
Object was not initialized (NSObject)

Below is my code to initialize the switch:

MySwitch.Initialize(B4XPages.GetNativeParent(Me),"BillingSameAs")

The switch view is on a CustomListView that is added to a TabStrip
 
Upvote 0

cwt

Active Member
Licensed User
Longtime User
What's wrong with B4XSwitch1.Value = True/False ?
My mistake and my apologies - I had the view name in the layout different than the name for the data declaration. Your code works fine and now mine does too.
 
Last edited:
Upvote 0
Top