iOS Question Switch doesn't handle event

Emme Developer

Well-Known Member
Licensed User
Longtime User
Hi everybody!
I've a switch in a class that doesn't handle any event.
I initialize it in this way
B4X:
Dim sw As Switch
        sw.Initialize("switch")
        p.AddView(sw,Main.MainPage.RootPanel.Width-66dip,6dip,51dip,29dip)
        sw.Enabled = True
        sw.Tag = SwList.Size
        SwList.Add(sw)

and i added switch in a Global list to avoid class will be release (and for others stuff). Anyone can help me if is there other things to add? Thanks!
 

JanPRO

Well-Known Member
Licensed User
Longtime User
Hi,
i added switch in a Global list to avoid class will be release
This will probably not work. You can see in the logs whether your class was released. Add a reference like this:
B4X:
sw.Tag = Me

Jan
 
Upvote 0

Emme Developer

Well-Known Member
Licensed User
Longtime User
Hi,

This will probably not work. You can see in the logs whether your class was released. Add a reference like this:
B4X:
sw.Tag = Me

Jan
Thanks for answer, i finally found the issue. Adding a switch in a global list prevent class from release, i did not see release on logs, so it works. Issue is in custom class in which i add switch, it will be release so class doesn't handle switch event
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…